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

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

            begin
            F1X := Form1.Left;
            F1Y := Form1.Top;
            F2X := Form2.Left;
            F2Y := Form2.Top;
            end;
            end;
            procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState;
            X, Y: Integer);
            begin
            if (CanMove) then
            begin
            if CanMoveX then
            Form1.Left := Form1.Left + (X - OldX);
            if CanMoveY then
            Form1.Top := Form1.Top + (Y - OldY);
            //This section latches to the top
            if (Form1.Top < WorkArea.Top + 10) and (Form1.Top > WorkArea.Top-10)
            then
            begin
            Form1.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 (Form1.Left < WorkArea.Left+10) and (Form1.Left >
            WoskArea.Left-10) then
            begin
            Form1.Left := WorkArea.Left;
            if (X-OldX > 10) or (X-OldX < -10) then
            CanMoveX := true
            else
            CanMoveX := False;
            end;

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

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

相关文章

关注我们

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