怎么修改marker的label的边框样式
1个回答
2017-03-10 · 互联网+时代高效组织信息化平台
关注
展开全部
给你个演示
Public Class LabelTest
Inherits System.Windows.Forms.Label
#Region " 组件设计器生成的代码 "
Public Sub New(Container As System.ComponentModel.IContainer)
MyClass.New()
'Windows.Forms 类撰写设计器支持所必需的
Container.Add(me)
End Sub
Public Sub New()
MyBase.New()
'该调用是组件设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'组件重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'组件设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是组件设计器所必需的
'可以使用组件设计器修改此过程。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
Private p_BorderColor As Color = Color.Gray '默认为灰色
Private Property BorderColor() As Color
Get
Return p_BorderColor
End Get
Set(ByVal Value As Color)
p_BorderColor = Value
End Set
End Property
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
If MyBase.BorderStyle = BorderStyle.None Then '如果是无边框则绘制,否则不予理睬
Dim drp As New System.Drawing.Pen(p_BorderColor)
Dim crect As Rectangle = e.ClipRectangle
crect.Inflate(-1, -1)
e.Graphics.DrawRectangle(drp, crect)
drp.Dispose()
End If
End Sub
End Class
Public Class LabelTest
Inherits System.Windows.Forms.Label
#Region " 组件设计器生成的代码 "
Public Sub New(Container As System.ComponentModel.IContainer)
MyClass.New()
'Windows.Forms 类撰写设计器支持所必需的
Container.Add(me)
End Sub
Public Sub New()
MyBase.New()
'该调用是组件设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'组件重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'组件设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是组件设计器所必需的
'可以使用组件设计器修改此过程。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
Private p_BorderColor As Color = Color.Gray '默认为灰色
Private Property BorderColor() As Color
Get
Return p_BorderColor
End Get
Set(ByVal Value As Color)
p_BorderColor = Value
End Set
End Property
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
If MyBase.BorderStyle = BorderStyle.None Then '如果是无边框则绘制,否则不予理睬
Dim drp As New System.Drawing.Pen(p_BorderColor)
Dim crect As Rectangle = e.ClipRectangle
crect.Inflate(-1, -1)
e.Graphics.DrawRectangle(drp, crect)
drp.Dispose()
End If
End Sub
End Class
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询