| Mirage Source http://miragesource.net/forums/ |
|
| Moving a Form Around http://miragesource.net/forums/viewtopic.php?f=210&t=2286 |
Page 1 of 1 |
| Author: | William [ Mon Jul 16, 2007 9:08 am ] |
| Post subject: | Moving a Form Around |
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. |
|
| Author: | James [ Wed Sep 05, 2007 1:33 pm ] |
| Post subject: | Re: Moving a Form Around |
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 Now in modConstants, add: Code: 'Varriables for Moving Forms Public Const WM_NCLBUTTONDOWN = &HA1 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. |
|
| Author: | William [ Wed Sep 05, 2007 1:36 pm ] |
| Post subject: | Re: Moving a Form Around |
Thanks |
|
| Author: | Robin [ Wed Sep 05, 2007 3:33 pm ] |
| Post subject: | Re: Moving a Form Around |
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? |
|
| Author: | James [ Wed Sep 05, 2007 8:50 pm ] |
| Post subject: | Re: Moving a Form Around |
Did you need to quote the whole post? Anyhow, it was near the top, with no replies, so I figured I may as well post it. Besides, WHY does it matter? it could help someone else in the future. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|