正在阅读:Delphi中的窗体移动Delphi中的窗体移动

2004-03-31 10:17 出处:delphi精髓网 作者:delphi精髓 责任编辑:sdq

            begin
            Form2.Top := WorkArea.Top;
            if (Y-OldY > 10) or (Y-OldY < -10) then
            CanMoveY := true
            else
            CanMoveY := False;
            end;
            //This section latches to the left side
            if (Form2.Left < WorkArea.Left+10) and (Form2.Left >
            WorkArea.Left-10) then
            begin
            Form2.Left := WorkArea.Left;
            if (X-OldX > 10) or (X-OldX < -10) then
            CanMoveX := true
            else
            CanMoveX := False;
            end;
            //This section latches to the right side
            if (Form2.Left > WorkArea.Right-Form2.Width-10) and (Form2.Left <
            WorkArea.Right-Form2.Width+10) then
            begin
            Form2.Left := WorkArea.Right-Form2.Width;
            if (X-OldX > 10) or (X-OldX < -10) then
            CanMoveX := true
            else
            CanMoveX := False;
            end;
            //This section latches to the TaskBar
            if (Form2.Top > WorkArea.Bottom-Form2.Height-10) and (Form2.Top <
            WorkArea.Bottom-Form2.Height+10) then
            begin
            Form2.Top := WorkArea.Bottom-Form2.Height;
            if (Y-OldY > 10) or (Y-OldY < -10) then
            CanMoveY := true
            else
            CanMoveY := False;
            exit;
            end;

察看评论详细内容 我要发表评论
作者笔名简短内容 发表时间
:

键盘也能翻页,试试“← →”键

相关文章

关注我们

最新资讯离线随时看 聊天吐槽赢奖品