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 37 38 39 40 41 42 43 44 45 46 47 48 49
|
Public Class cdtPanel
Inherits System.Windows.Forms.Panel
Public Sub New()
End Sub
Private bWidth As Integer
Public Property BorderWidth() As Integer
Get
Return Me.bWidth
End Get
Set(ByVal value As Integer)
Me.bWidth = Math.Abs(value)
Me.Refresh()
End Set
End Property
Private bColor As Color
Public Property BorderColor() As Color
Get
Return Me.bColor
End Get
Set(ByVal value As Color)
Me.bColor = value
Me.Refresh()
End Set
End Property
Private bName As String
Public Property NamePD() As String
Get
Return Me.bName
End Get
Set(ByVal value As String)
Me.bName = value
Me.Refresh()
End Set
End Property
Public Overridable Sub cdtPanel_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim myPen As New Pen(Me.bColor, Me.bWidth)
Dim dashValues As Single() = {5, 2, 15, 2}
myPen.DashPattern = dashValues
e.Graphics.DrawRectangle(myPen, Me.ClientRectangle)
e.Graphics.DrawString(Me.NamePD, New Font("Arial", 12, FontStyle.Bold), Brushes.Blue, (Me.ClientSize.Width / 2) - 10, (Me.ClientSize.Height / 2) - 10, New StringFormat)
End Sub
End Class |
Partager