在 Form 的 private 处写入 procedure WMMove(var Message: TWMMove); message WM_MOVE;然后在代码处写 procedure Form1.WMMove(var Message: TWMMove); Begin IF Left<0 then Left:= 0; IF Top<0 Then Top:= 0; end;
WMMove是什么事件阿,应该加在哪里
procedure Form1.WMMove(var Message: TWMMove); Begin IF Left<0 then Left:= 0; IF Top<0 Then Top:= 0; end; 加在哪里呢
type TForm1 = class(TForm) private procedure WMMove(var Message: TWMMove); message WM_MOVE; { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.DFM} procedure TForm1.WMMove(var Message: TWMMove); Begin IF Left<0 then Left:= 0; IF Top<0 Then Top:= 0; IF Left+Width> Screen.Width Then Left:= Screen.Width - Width; If Top + Height > Screen.Height Then Top:= Screen.Height - Height; end;不是.因为刚才懒得去写代码,因为我没有现成的.既然你发邮件了.我就唯有写了.
procedure WMMove(var Message: TWMMove); message WM_MOVE;然后在代码处写
procedure Form1.WMMove(var Message: TWMMove);
Begin
IF Left<0 then Left:= 0;
IF Top<0 Then Top:= 0;
end;
Begin
IF Left<0 then Left:= 0;
IF Top<0 Then Top:= 0;
end;
加在哪里呢
procedure WMMove(var Message: TWMMove); message WM_MOVE;
是在
private?
{? Private declarations ?}?
的哪里呢.在有?的地方输入无法通过编译
去下载看看.
procedure TForm1.Button1Click(Sender: TObject);
Var
rtButton2: TRect;
Temp:integer;
begin
rtButton2 := Button2.BoundsRect;
MapWindowPoints(handle, 0, rtButton2, 2); // 座标换算
ClipCursor(@rtButton2); // 限制滑鼠移动区域
SystemParametersInfo(spi_screensaverrunning,1,@temp,0);
end;
搞定收工...
Var
rtButton2: TRect;
Temp:integer;
begin
rtButton2 := Button2.BoundsRect;
MapWindowPoints(handle, 0, rtButton2, 2); // 座标换算
ClipCursor(@rtButton2); // 限制滑鼠移动区域
SystemParametersInfo(spi_screensaverrunning,1,@temp,0);
end;
是控制鼠标的,我是要控制form的范围
TForm1 = class(TForm)
private
procedure WMMove(var Message: TWMMove); message WM_MOVE;
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}
procedure TForm1.WMMove(var Message: TWMMove);
Begin
IF Left<0 then Left:= 0;
IF Top<0 Then Top:= 0;
IF Left+Width> Screen.Width Then Left:= Screen.Width - Width;
If Top + Height > Screen.Height Then Top:= Screen.Height - Height;
end;不是.因为刚才懒得去写代码,因为我没有现成的.既然你发邮件了.我就唯有写了.
你要将错误信息贴出来三.你不要告诉我.你是粘贴放到你的PAS里的吧.如果是这样当然不行呀.
else Form2.FormonMouseMove = ture
把这些加入设为全屏幕事件的代码无法通过编译?
Var
rtform1: TRect;
Temp:integer;
begin
rtform1 := form1.BoundsRect;
MapWindowPoints(handle, 0, rtform1, 0); // 座标换算
ClipCursor(@rtform1); // 限制滑鼠移动区域
SystemParametersInfo(spi_screensaverrunning,1,@temp,0);
end;这下绝对符合你的要求了