Mirage Source
Moving a Form Around - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: Moving a Form Around (/showthread.php?tid=1103)



Moving a Form Around - William - 16-07-2007

Do anybody have the declares and such to move a form around when pressing and draging a label? I have a piece of code but its target based and not so good.


Re: Moving a Form Around - William - 05-09-2007

Thanks Smile But I already had this one figured out. I'd suggest you post it in the feature tutorial.


Re: Moving a Form Around - Robin - 05-09-2007

Magnus Wrote:Here we go:

Add this to modDeclares:

Code:
'Move Form Declares
Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Add this somewhere. I have a modMenu with the menu code, but wherever is fine:

Code:
Public Sub MoveForm(F As Form)
    ReleaseCapture
    SendMessage F.hWnd, WM_NCLBUTTONDOWN, 2, 0
End Sub

Now finally, on frmMirage add this to Form Mousedown or Label Mousedown:

Code:
Call MoveForm(Me)

There you go. Have fun.

He posted the question... how many months ago?