• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 661
  • Last Modified:

Size an mdi form with ismdicontainer property true and child form regardless of screen resolution

Hello Experts,
I have to size an mdi form (800*600 pixel) with ismdicontainer property true and child form regardless of screen resolution, so that the child form are contained in the mdi form without the scroll bars in the mdi form.
If I change resolution or the format of charater from 96 dpi to 120 dpi the scroll bar appear in the mdi form,
how can I resize the child form so that the the scroll bar do not appear also if I change screen resolution?

Another question: how can I set the backcolor of the mdi form, it is also dark grey also if I set a different color, from example green?

Thanks at all for help
  • 2
1 Solution
Fernando SotoRetiredCommented:
Hi aldog1;

Let me take the easy question first. In order to change the BackColor of the MDI container you need to get a reference to the control that Microsoft places there and that is not available at design time. To change the BackColor of the MDI container see sample code below.

    Private Sub Form1_Load(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Load
        For Each ctl As Control In Me.Controls
            If ctl.GetType Is GetType(MdiClient) Then
                Dim mdi As MdiClient = CType(ctl, MdiClient)
                mdi.BackColor = Color.Green
            End If
    End Sub

Open in new window

Fernando SotoRetiredCommented:
As far as the first part of the question you can use the Form.ReSize event to resize the child mdi's on the form by using the Form.ClientSize to get the available space on the form.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now