1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or &H20
Return cp
End Get
End Property
Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim Color As Color = Color.FromArgb(Opacity, Me.BackColor)
e.Graphics.FillRectangle(New SolidBrush(Color), e.ClipRectangle)
End Sub
Private m_Opacity As Integer
Public Property Opacity() As Integer
Get
Return m_Opacity
End Get
Set(ByVal value As Integer)
m_Opacity = value
InvalidateEx()
End Set
End Property
Private Sub InvalidateEx()
Try
If (Parent Is Nothing) Then
Return
End If
Dim rc As Rectangle = New Rectangle(Me.Location, Me.Size)
Parent.Invalidate(rc, True)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub |
Partager