Tuesday, March 10, 2009

How to change the backgroud color of MDI windows

Code below:
For Each ctrl As Control In Controls
        If ctrl.GetType() IsNot GetType(MdiClient) Then
          Continue For
        End If

        Dim colorName As String = ConfigurationManager.AppSettings("Dialog.BackColor")
        If colorName Is Nothing Then
          Exit For
        End If

        Dim color As Color = color.FromName(colorName)
        'checks if color is transparent, mdiclient.backcolor doesn't support transparent colors
        If color.A <> 0 Then
          ctrl.BackColor = color.FromName(colorName)
        End If
next
Post a Comment