Freerider
asked on
Moving a form without border.
Hi all,
can anyone tell me how to make a form with [BorderStyle = bsNone] moveable? I am displaying an image on the form and don't want a border.
Thanks,
Freerider.
can anyone tell me how to make a form with [BorderStyle = bsNone] moveable? I am displaying an image on the form and don't want a border.
Thanks,
Freerider.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hello Freerider, you might try
procedure TForml.MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
Const SC_DragMove = $F012;
begin
if (Button = mbLeft) then
begin
ReleaseCapture;
Self.perform(WM_SysCommand , SC_DragMove, 0);
end;
end;
the SC_DragMove is issued by the system after a htCaption, WM_NCHITTEST
procedure TForml.MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer);
Const SC_DragMove = $F012;
begin
if (Button = mbLeft) then
begin
ReleaseCapture;
Self.perform(WM_SysCommand
end;
end;
the SC_DragMove is issued by the system after a htCaption, WM_NCHITTEST
procedure WMNCHitTest(var Msg : TMessage); message WM_NCHITTEST;
procedure TForm1.WMNCHitTest(var Msg : TMessage);
begin
if GetAsyncKeyState(VK_LBUTTO N) < 0 then
Msg.Result := HTCAPTION
else
Msg.Result := HTCLIENT;
end;
It makes windows think you are clicking on the title bar when you are clicking in the client area.
procedure TForm1.WMNCHitTest(var Msg : TMessage);
begin
if GetAsyncKeyState(VK_LBUTTO
Msg.Result := HTCAPTION
else
Msg.Result := HTCLIENT;
end;
It makes windows think you are clicking on the title bar when you are clicking in the client area.
ASKER
Thanks,
I'll let you know how I get on...
I'll let you know how I get on...
Hi Freerider,
put this code in either onMouseClick or onMouseDown for the form or the image or both
ReleaseCapture;
TForm(form1).perform(WM_SY SCOMMAND, $F012, 0);
Regards
Hill
put this code in either onMouseClick or onMouseDown for the form or the image or both
ReleaseCapture;
TForm(form1).perform(WM_SY
Regards
Hill
Freerider:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
procedure TfrMenu.FormCreate(Sender:
begin
bmpFondo := TBitmap.Create;
bmpFondo.LoadFromFile( 'c:\pan\MyBmp.bmp' );
end;
procedure TfrMenu.FormDestroy(Sender
begin
bmpFondo.Free;
end;
procedure TfrMenu.FormPaint(Sender: TObject);
begin
Canvas.Draw(163, 55, bmpFondo );
end;
Best Regards.
Marcos.