1

How to get back to white form background when IsMdiContainer is true?

form becomes gray and i cant change it .

Me.BackColor.FromArgb(255, 255, 255) it doesnt work, it justs makes background white of the minimize and maximize buttons.

rkz
  • 13
  • 1
  • 5
  • 1
    Possible duplicate of [Change backcolor or background image of a MDI Container form in .net](http://stackoverflow.com/questions/2542972/change-backcolor-or-background-image-of-a-mdi-container-form-in-net) – Capellan Feb 23 '17 at 13:03

3 Answers3

2
For Each ctl As Control In Me.Controls
    If TypeOf ctl Is MdiClient Then
        ctl.BackColor = Me.BackColor
    End If
Next ctl
0

Try This "this will change the color of your mdi container"

  Public Sub MDIBGColor()
        Dim ctl As Control
        Dim ctlMDI As MdiClient

        ' Loop through all of the form's controls looking
        ' for the control of type MdiClient.
        For Each ctl In Me.Controls
            Try

                ' Attempt to cast the control to type MdiClient.
                ctlMDI = CType(ctl, MdiClient)

                ' Set the BackColor of the MdiClient control.
                ctlMDI.BackColor = Me.BackColor

            Catch exc As InvalidCastException
                ' Catch and ignore the error if casting failed.
            End Try
        Next

    End Sub

and call the sub on the form load event

Adam
  • 147
  • 1
  • 13
0
#Region "Change Background Color of MDIParent : bgcolor()"
'to change the background color of mdiparent

Private Sub bgColor()
    Dim child As Control
    For Each child In Me.Controls
        If TypeOf child Is MdiClient Then
            child.BackColor = Color.CadetBlue
            Exit For
        End If
    Next
    child = Nothing
End Sub

use this in any click or form load

Nader MA
  • 117
  • 1
  • 5