您的位置首页百科快答

MoveWindow坐标定位,该怎么处理

MoveWindow坐标定位,该怎么处理

的有关信息介绍如下:

MoveWindow坐标定位,该怎么处理

Delphi(Pascal) code PreX,PreY:Integer;implementation

{$R *.dfm}

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

PreX:=X;

PreY:=y;

end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

begin

if (PreX>0) and (PreY>0) then

MoveWindow(Self.Handle,Self.Left+X-PreX,Self.Top+Y-PreY,Self.Width,Self.Height,True);

end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

PreX:=0;

PreY:=0;

end;

Delphi(Pascal) code PreX,PreY:Integer;

implementation

{$R *.dfm}

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

PreX:=X;

PreY:=y;

end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

begin

if (PreX>0) and (PreY>0) then

MoveWindow(Self.Handle,Self.Left+X-PreX,Self.Top+Y-PreY,Self.Width,Self.Height,True);

end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

PreX:=0;

PreY:=0;

end;

Delphi(Pascal) code PreX,PreY:Integer;

implementation

{$R *.dfm}

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

PreX:=X;

PreY:=y;

end;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,

Y: Integer);

begin

if (PreX>0) and (PreY>0) then

MoveWindow(Self.Handle,Self.Left+X-PreX,Self.Top+Y-PreY,Self.Width,Self.Height,True);

end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

begin

PreX:=0;

PreY:=0;

end;