How To: Make a label background color the same as its gradient form?

E

Eric

I created a gradient form and want the background of the labels to take on
the same color pattern as the parent form. Is this easily possible?

Thanks
 
K

Ken Tucker [MVP]

Hi,

Set the labels background color to transparent.

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Label1.BackColor = Color.Transparent
End Sub


Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim gb As New Drawing2D.LinearGradientBrush(Me.ClientRectangle,
Color.Blue, Color.White, Drawing2D.LinearGradientMode.BackwardDiagonal)
e.Graphics.FillRectangle(gb, Me.ClientRectangle)
End Sub
End Class

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top