2
我使用的是自定義標籤,使前景色當標籤被禁用(通過使用下面)圍繞自定義標籤文本
如何居中文本爲標準lablel時自動調整大小是不關閉,文本對齊是否設置爲TopCenter?我已經嘗試使用對齊選項的StringFormat,但是這不與中心對齊。
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Dim LabelBrush As New SolidBrush(Me.ForeColor)
Dim SF As New StringFormat
SF.FormatFlags = StringFormatFlags.NoWrap
SF.Alignment = StringAlignment.Center
SF.LineAlignment = StringAlignment.Center
LabelBrush.Color = DisabledColor_Dark
e.Graphics.DrawString(Me.Text, Me.Font, LabelBrush, Padding.Left, Padding.Right, SF)
LabelBrush.Dispose()
LabelBrush = Nothing
End Sub