Change background color of MDIParent Form in VB.Net

In you can not change the background color [actually it is called as BackColor property] of MDIParent [IsMdiContainer = true] form, but you can change it by changing the color of  MDIChild form that are executing currently to your desired color, so it look like the color of MDIParent is changed.

The Code for it is provided below. Just called this function bgColor() into your load method of your MDIParent.

Code :

#Region "Change Background Color of MDIParent : bgcolor()"
    'to change the background color of mdiparent
    'for more :

    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
    child = Nothing
    End Sub
#End Region

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s