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; |
正在阅读:Delphi中的窗体移动Delphi中的窗体移动
2004-03-31 10:17
出处:delphi精髓网
责任编辑:sdq
键盘也能翻页,试试“← →”键