| View previous topic :: View next topic |
| Author |
Message |
angerist Grandmaster Cheater Supreme
Reputation: 0
Joined: 18 Jun 2007 Posts: 1011 Location: Australia.
|
Posted: Sun Dec 07, 2008 4:50 am Post subject: [SOLVED!] manoeuvre a form with TImage |
|
|
Just wondering if anyone can share some info on how this would work. What I want to do is use TImage to manoeuvre my form just like a caption bar would.
Notice the typo in the screenie
Discuss,
_________________
Last edited by angerist on Mon Dec 08, 2008 12:07 am; edited 1 time in total |
|
| Back to top |
|
 |
bartil Advanced Cheater
Reputation: 0
Joined: 11 Jul 2006 Posts: 91
|
Posted: Sun Dec 07, 2008 7:15 am Post subject: |
|
|
| Code: | ReleaseCapture;
SendMessage(Handle,WM_SYSCOMMAND,61458,0); |
put it in your image's mouse down event...
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Sun Dec 07, 2008 7:16 am Post subject: |
|
|
| Code: | procedure TForm.OnMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbLeft then
begin
SetCaptureControl(nil);
Perform(wm_SysCommand, sc_Move or 1, 0);
end;
end; |
|
|
| Back to top |
|
 |
angerist Grandmaster Cheater Supreme
Reputation: 0
Joined: 18 Jun 2007 Posts: 1011 Location: Australia.
|
Posted: Sun Dec 07, 2008 10:10 pm Post subject: |
|
|
First method didn't work. Not sure about 2nd .
EDIT:
I found this info on the net. But This doesn't support components. So all I can do with my form is move it around. Buttons ect ect don't work.
1. insert the following line into your form's "Private declarations" section (message handling procedure declaration):
| Code: |
procedure WMNCHitTest(var Msg: TWMNCHitTest);
message wm_NCHitTest; |
2. add the following code into the "implementation" section of your form's unit (where Form1 is assumed form name):
| Code: | procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
inherited;
if Msg.Result = htClient then
Msg.Result := htCaption;
end; |
_________________
|
|
| Back to top |
|
 |
Wintermoot Expert Cheater
Reputation: 0
Joined: 08 Nov 2007 Posts: 198
|
Posted: Mon Dec 08, 2008 6:02 am Post subject: |
|
|
I just tested. All the codes posted work. The final method using WMNCHitTest is inadvisable as it removes all mouse events.
I suggest you use Reak's source since, that also allows you to add right-click functionality to the 'caption bar'...
I suggest you google before making a thread. The first result on google when searching for 'Delphi move form without caption' would have solved your problem.
|
|
| Back to top |
|
 |
|