Click here to Skip to main content
15,889,838 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How will i gradient color to the MDI Form whenever IsMDIContainer is true???
But fine work whenever IsMDIContainer is false.

Please help me some instruction....
Posted

1 solution

try this one.
VB
Public Class Form1

    Private WithEvents client As MdiClient

    Private Sub Form1_Load(ByVal sender As Object, _
                           ByVal e As EventArgs) Handles MyBase.Load
        Me.client = Me.Controls.OfType(Of MdiClient).First()
    End Sub

    Private Sub client_Paint(ByVal sender As Object, _
                             ByVal e As PaintEventArgs) Handles client.Paint
        Using Brush As New Drawing2D.LinearGradientBrush(Me.client.Bounds, _
                                                         Color.FromArgb(0, 58, 140), _
                                                         Color.FromArgb(0, 215, 255), _
                                                         Drawing2D.LinearGradientMode.Vertical)
            e.Graphics.FillRectangle(Brush, Me.client.Bounds)
        End Using
    End Sub

End Class
 
Share this answer
 
Comments
Member 7678194 1-Aug-12 4:48am    
But sending code is shown error.
Error is "'OfType' is not a member System.Windows.Forms.Control.ControlCollection"
then how will i solve it???
Please send me right code....
graciax8 1-Aug-12 4:53am    
read this
http://www.vbforums.com/showthread.php?552425-2008-MDI-form-gradient

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900