-
Aug 7th, 2015, 02:44 AM
#1
Thread Starter
Hyperactive Member
Removing Scroll bars from MDI Main
Hi there,
Please have a look on attached file, this is MDI Parent form, when i move child form to lower bottom side, both horizontal and vertical scroll bars appears on MDI Main form. I don't want to show scroll bars on main mdi form, or in other words how can i hide scroll bars from main mdi form.
I found several answers on google but not even a single work.
Autoscroll property is also false but still i am getting scroll bars on parent mdi form.
Please help me out how to remove scroll bars from mdi main parent form.
Thanks
Ladak
-
Aug 7th, 2015, 08:07 AM
#2
Re: Removing Scroll bars from MDI Main
You can't remove the scroll bars (at least not with managed code), but since the mdiClient is simply another control in the forms collection, you get grab a reference to it and resize it so the scroll bars don't show.
vb.net Code:
'find the mdiClient in the controls collection
For Each ctl As Control In Me.Controls
If TypeOf ctl Is MdiClient Then
'got the control, so cast it
Dim mdiClientControl As MdiClient = DirectCast(ctl, MdiClient)
'undock it
mdiClientControl.Dock = DockStyle.None
'resize it
mdiClientControl.Bounds = Me.ClientRectangle
mdiClientControl.Height += 20
mdiClientControl.Width += 20
'set the anchors
mdiClientControl.Anchor = AnchorStyles.Bottom Or AnchorStyles.Left Or AnchorStyles.Right Or AnchorStyles.Top
'bail out
Exit For
End If
Next
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Feb 27th, 2018, 03:13 PM
#3
Hyperactive Member
Re: Removing Scroll bars from MDI Main
Hi guys
I know this is an old post, but...
I have Form2 show at load
Without the code, Form2 shows under the MenuStrip
But with the code it shows behind MenuStrip
Any idea?
Thanks
-
Feb 28th, 2018, 03:48 AM
#4
Re: Removing Scroll bars from MDI Main
Originally Posted by threeeye
Any idea?
That code starts by setting the Bounds of the MdiClient control to the ClientRectangle of the form. That means that its Location will be (0, 0). Just as the code then modifies the Height and Width properties, you would need to modify the Top property to move it down the height of the menu. I would expect something like this to work:
vb.net Code:
mdiClientControl.Top += Me.MenuStrip1.Height
-
Feb 28th, 2018, 09:28 AM
#5
Hyperactive Member
Re: Removing Scroll bars from MDI Main
Originally Posted by jmcilhinney
That code starts by setting the Bounds of the MdiClient control to the ClientRectangle of the form. That means that its Location will be (0, 0). Just as the code then modifies the Height and Width properties, you would need to modify the Top property to move it down the height of the menu. I would expect something like this to work:
vb.net Code:
mdiClientControl.Top += Me.MenuStrip1.Height
Nice!
Thanks!
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
|