D
Dean Slindee
It appears that I have two routines that don't play well together! First
routine: a form's background is shaded with a gradient color. Second
routine: then, the background of all labels on the form are made
transparent. What results is the label's backcolor appearing as blocks of
'control' colored background. Setting the label's backcolor to
color.transparent does not make it transparent (evidently the text is
repainted with a control-colored backcolor. Here is the code. Do any of
you graphics gurus know of a way to make the labels appear transparent in
front of a gradient form background?
Private Sub frmAdminActivity_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
'gradient form background routine:
Dim x As Integer = Me.Width
Dim y As Integer = Me.Height
Dim g As Graphics = Me.CreateGraphics
Dim lgBrush As New LinearGradientBrush(New Point(0, 0), New Point(x,
y), _
Color.FromArgb(190, 190, 190),
Color.WhiteSmoke)
g.FillRectangle(lgBrush, 0, 0, x, y)
g.Dispose()
'transparent label routine:
Dim ctl As Control
Dim str As String
For Each ctl In Me.Controls
str = ctl.GetType.ToString
If str = "System.Windows.Forms.Label" Then
ctl.BackColor = System.Drawing.Color.Transparent
End If
Next
routine: a form's background is shaded with a gradient color. Second
routine: then, the background of all labels on the form are made
transparent. What results is the label's backcolor appearing as blocks of
'control' colored background. Setting the label's backcolor to
color.transparent does not make it transparent (evidently the text is
repainted with a control-colored backcolor. Here is the code. Do any of
you graphics gurus know of a way to make the labels appear transparent in
front of a gradient form background?
Private Sub frmAdminActivity_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
'gradient form background routine:
Dim x As Integer = Me.Width
Dim y As Integer = Me.Height
Dim g As Graphics = Me.CreateGraphics
Dim lgBrush As New LinearGradientBrush(New Point(0, 0), New Point(x,
y), _
Color.FromArgb(190, 190, 190),
Color.WhiteSmoke)
g.FillRectangle(lgBrush, 0, 0, x, y)
g.Dispose()
'transparent label routine:
Dim ctl As Control
Dim str As String
For Each ctl In Me.Controls
str = ctl.GetType.ToString
If str = "System.Windows.Forms.Label" Then
ctl.BackColor = System.Drawing.Color.Transparent
End If
Next