模拟对接将表格缩小,从底座上移除时,只有在鼠标向下聚焦时,表格才会保持完整尺寸

时间:2012-01-13 05:55:14

标签: c#-4.0

通话模块:

    private void Indicator_Move(object sender, EventArgs e)
    {
        Sizer size = new Sizer();
        int x = this.Location.X;
        int y = this.Location.Y;
        int width = this.Width;
        int height = this.Height;
        var screenWidth = Screen.PrimaryScreen.WorkingArea.Width - 130;
        if (x >= screenWidth)
        {
            size.checkmove(x, y, width, height, this);
        }
        else if (width == 158 )
        {
            width = 235;
            height = 223;
            this.Size = new System.Drawing.Size(width, height);
        }
    }

要从Sizer类停靠和缩小大小的模块:

    public void checkmove(int movex, int movey,int width, int height, Form mover)
    {
        var moverheight = mover.Height;
        var screenWidth = Screen.PrimaryScreen.WorkingArea.Width - 130;
        var screenHeight = Screen.PrimaryScreen.WorkingArea.Height;
        var finalx = screenWidth;
        if (movex > screenWidth)
        {
            mover.Size = new System.Drawing.Size(154, 45);
            mover.Location = new Point(finalx, screenHeight - 600);
        }
    }

1 个答案:

答案 0 :(得分:0)

我实际上找到了一种不同的方法来完成我想要的表格上的double_click事件,并将其移到桌面上它的全尺寸,但我仍然很好奇它为什么来回调整大小并减少移动并显示闪烁和缩小的大小,仅在单击鼠标按钮并按住鼠标按钮时显示完整大小。我认为它与表单移动时的resizeend调用有关。并感谢Joran的编辑。