Change background color of MDIParent Form in VB.Net

In vb.net 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 : https://acomputerengineer.wordpress.com

    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
#End Region
Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s