|
皆様ありがとうございます。 重鎮の方々まで...恐れ多いのですが、ソースの抜粋です。
''' <summary> ''' 下線付きラベルです。 ''' </summary> Partial Public Class UnderLineLabel Inherits System.Windows.Forms.Label
''' <summary> ''' 線幅のメンバ ''' </summary> Private _large As Single = 1.0F
''' <summary> ''' 描画する線幅を指定する ''' </summary> <DefaultValue(1.0F)> _ Public Property LineLarge() As Single Get Return Me._large End Get Set(ByVal value As Single) If value < 1 Then Me._large = 1.0F Else Me._large = value End If End Set End Property
''' <summary> ''' 描画処理 ''' </summary> ''' <param name="e"></param> Protected Overloads Overrides Sub OnPaint(ByVal e As PaintEventArgs) MyBase.OnPaint(e)
'線パターンにあわせて描画する。 Using sb As New SolidBrush(Me.ForeColor) 'xy等を調べる Dim x As Single = e.Graphics.VisibleClipBounds.X 'Dim y As Single = e.Graphics.VisibleClipBounds.Y Dim width As Single = e.Graphics.VisibleClipBounds.Width Dim height As Single = e.Graphics.VisibleClipBounds.Height '線を描画する '上辺 e.Graphics.FillRectangle(sb, 0, height - _large, width, height) End Using
End Sub
End Class
|