X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Moving a none borderstyle form with the mouse    
post Jan 10 2006, 08:19 PM

Posts: 129
Joined: 21-March 03
From: Argentina - Tucuman Province

This is the way I've found for moving a form with the mouse, when the form borderstyle property is set to none. Of course, the moveable property of the form must be set in yes.
form with none borderstyle doesn't have a 'control box' (which usually contains the min, max and close buttons, the title bar, and that let us move the form just left clicking with the mouse), but it´s possible to 'substitute' it with the use of other objects (as a rectangle, a line, an image or other form objects) and its mousedown event or click event.
In a form view, that 'substitution' will allow us to:
1) Select the form with the mouse from its actual position in the screen
2) Drag the form to the next position in the screen
In the code, in the form object mousedown event or click event, we have to use the sendkeys instruction and the DoCmd object with the runcommand method, as follows:
Private Sub rectangle1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = acLeftButton Then
'using both sendkeys instructions we avoid a little displacement of the form
SendKeys "{UP}"
SendKeys "{DOWN}"
'the four-headed arrow will indicate that we could drag the form
Screen.MousePointer = 3
DoCmd.RunCommand acCmdDocMove
'once we drop the form, the pointer will return to its original look
Screen.MousePointer = 0
End If
End Sub
Using the same code with the click event, causes that the form remains attached with the mouse pointer until we do another click.
The code has been proved in access 2000 and access xp, and it worked fine.
I hope this solution could be useful for those who are begining with access, or don't know how to do it.
If someone knows a more simple solution, please let me know it.
Attached File(s)
Attached File  MoveNoneBorderForm.zip ( 31.27K )Number of downloads: 388
Go to the top of the page
Start new topic
post Sep 23 2019, 08:48 PM

Posts: 1
Joined: 23-September 19

Thank you
Go to the top of the page

Posts in this topic
- Ernesto   Moving a none borderstyle form with the mouse   Jan 10 2006, 08:19 PM
- - Cyberjudge   Thank you   Sep 23 2019, 08:48 PM
- - isladogs   This is certainly an ancient thread resurrected. f...   Sep 23 2019, 11:13 PM

Custom Search

RSSSearch   Top   Lo-Fi    9th April 2020 - 05:55 AM