|
-
February 28th, 2006, 03:11 PM
#1
prevent move or resizing of MDI child
Hi,
I have an MDI application and I don't want the user to move or resize any of the child forms, i'e they need to have fixed size and location.
I put fals eon contorl box, but they still can move and resize.
Now i put some code in resize and move event sto prevent this successfully, but it's not elegent. There's lot of flickering when user has the mouse down and is attempting to move or resize.
Is there soem nicer way to accomplish this, which won't look shabby like with all the flickering.
-
February 28th, 2006, 11:24 PM
#2
Re: prevent move or resizing of MDI child
to make the child unresizable change
formBorderSize = fixedToolWindow
minimizeBox = false
maximizeBox = false
to make the form imMoveable get this SystemMenuManager class
add code to form load
Code:
Dim myMenuManager As New SystemMenuManager(Me, False, SystemMenuManager.MenuItemState.Greyed)
hope u got it
-
March 1st, 2006, 04:26 PM
#3
Re: prevent move or resizing of MDI child
Thanks for you reply.
The sizing probblem is fixed. But the moving isn't by using your exmaple.
What I want is when someone click ont eh caption(title) bar of the form ( the control box is set to false ) and try to move form by dragging it , he should not be able to do so.
what i did was:
Private Sub CForm_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LocationChanged
If Not mMove Then Me.Location = mRect.Location
End Sub
where mRect has been initiliazed to an area. This works but it produce the flickering effect.
i tried you way by using that lien of code, but that dosn't stop em from draggin the form in MDI client area to where i want to
Thanks again fot the reply
-
March 1st, 2006, 04:27 PM
#4
Re: prevent move or resizing of MDI child
One additional question. Is there a way to get rid of the title bar altogether, so that all i have in a form is the client area
-
March 2nd, 2006, 06:00 AM
#5
Re: prevent move or resizing of MDI child
set the form text property empty and controlBox property to false ,u will have only the client area.
-
March 2nd, 2006, 08:43 AM
#6
Re: prevent move or resizing of MDI child
 Originally Posted by venAdder
what i did was:
Private Sub CForm_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LocationChanged
If Not mMove Then Me.Location = mRect.Location
End Sub
where mRect has been initiliazed to an area. This works but it produce the flickering effect.
Just for interest sake.. I had a similar problem in moving forms, what I managed to do was use this code to remove the flickering.
Code:
'Declarations
'constants to move form
Private Const WM_NCHITTEST As Integer = &H84
Private Const HTCLIENT As Integer = &H1
Private Const HTCAPTION As Integer = &H2
'move form
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Select Case m.Msg
Case WM_NCHITTEST 'to drag
MyBase.WndProc(m)
If (m.Result.ToInt32 = HTCLIENT) Then 'client
m.Result = IntPtr.op_Explicit(HTCAPTION) 'name of window
End If
Exit Sub
End Select
MyBase.WndProc(m)
End Sub
I know you're looking for a way to prvent people from moving the form, but since you mentioned the flickering effect, I thought to post this to prevent the flickering event.
-
March 18th, 2006, 10:06 AM
#7
Re: prevent move or resizing of MDI child
 Originally Posted by venAdder
One additional question. Is there a way to get rid of the title bar altogether, so that all i have in a form is the client area
Wouldnt you simply set the "FormBorderStyle" in the Properties window to "None" That will give you a smooth (no border at all) finish.
-
March 18th, 2006, 10:47 AM
#8
Re: prevent move or resizing of MDI child
Very good Frametech I was going to suggest the same, as I have done it that way before
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|