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