detect when form activate reach the limit of the form
hi,
there is any way to detect
when a form activate reach the limit of the mdiform?
the limit that i want detect is: top,bottom,left,right when the form pass
from the limit border of the mdiform a msg will appear like a auto scrool appear
i need detect this for all forms that i have in the project
thanks for your help
Re: detect when form activate reach the limit of the form
hi,
i put a image that show what i have.
i have some forms inside a mdiform and i want know when a form reach the border limit
of the mdiform for when the form reach that border the form will leave the mdiform.
them when the form is outside of the mdiform i want put the form inside the mdiform again.
i just need know how detect wich form is selected inside a mdiform and the position of that form.
thanks a lot for your help
Re: detect when form activate reach the limit of the form
If you want to allow the form to show outside the MDI, then perhaps you don't need an MDI. However, can you clarify what you said about putting the form back inside the MDI again? Why remove it, only to put it right back again? Are you trying to prevent the user from moving the form beyond the boundary of the MDI? Please provide additional details on what it is you want to ultimately accomplish.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
Re: detect when form activate reach the limit of the form
hi,
no the objetive of remove/put in the mdiform is only for be more produtive desktop just that,
imagine that you have 2 or 3 lcd and you want a form in each lcd but in the mdiform you want
certain forms it is very cool for organization etc but the question is not that i only need detect when the form is near from border limit of the mdiform just that
Re: detect when form activate reach the limit of the form
Sounds like all you need to do is check the size of the mdi, the size of the form in question and the locations of the two forms. I would think you might want this code in the drag event of the form.
Re: detect when form activate reach the limit of the form
What drag event would that be? Neither DragDrop nor DragOver would fire if the form is moved.
You can use this to detect the presence of scrollbars on the MDI form:
Code:
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long _
) As Long
Private Const GWL_Style = (-16)
Private Const WS_HScroll As Long = &H100000
Private Const WS_VScroll As Long = &H200000
Private Function GetScrollBarStyle(hWnd As Long) As Integer
GetScrollBarStyle = (GetWindowLong(hWnd, GWL_Style) / WS_HScroll) And 3
End Function
GetScrollBarStyle will return 1 for horizontal, 2 for vertical, 3 for both and 0 for no scrollbars.
The question is: when would you do this?
Maybe use a timer and check each 500msec. If scrollbars are shown then you step through all the windows and reposition those which are out of MDI form's area.
Re: detect when form activate reach the limit of the form
My mistake. I was not aware that there was no event fired when a form was dragged in the mdi window though I would imagion there must be an API call to capture such an event.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.