itop粉丝盛典:Delphi如何实现无边框窗体的移动?

来源:百度文库 编辑:高校问答 时间:2024/04/29 01:10:47
如题,现有Form1窗体,边框属性为0(无边框)
如何实现这种窗体通过鼠标拖动窗体任意位置而移动呢?
请写出程序有关代码,谢谢!

在控件的MouseDown事件中加入
if (ssleft in Shift) then
begin ReleaseCapture; Perform(WM_syscommand, $F012, 0);
end;
如form1:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if (ssleft in Shift) then
begin ReleaseCapture; Perform(WM_syscommand, $F012, 0);
end;
end;
end.