zeny » 06.03.2006 (Пн) 19:11
Вот нашел, может кому-нибудь понадобится:
Public Class TransparentLabel
Inherits Control
Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)
'do nothing
End Sub
Private bPaintOnce As Boolean = False 'flag to prevent infinite loop
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
If (bPaintOnce = False) Then
bPaintOnce = True
Me.Visible = False
Me.Parent.Invalidate(Me.Bounds) 'more efficient than me.Parent.Refresh
Me.Parent.Update() 'force parent to redraw only invalidated regions
Me.Visible = True
Return
Else
bPaintOnce = False
Dim g As Graphics = e.Graphics
Dim myBrush As SolidBrush = New SolidBrush(Me.ForeColor)
g.DrawString(Me.Text, Me.Font, myBrush, 1, 1)
g.Dispose()
End If
End Sub
End Class
ну и потом соответственно:
'В form_load или после InitializeComponent
Dim myLabel As New TransparentLabel
Me.Controls.Add(myLabel)
myLabel.BringToFront
myLabel.Left=1
myLabel.Top=1
...