|
Public Class ControlCaption : Inherits DrawObjectBase
Public ReadOnly StringFormat As StringFormat = AddDisposable(New StringFormat)
Protected _Text As String
Public Function Text(ByVal NewValue As String) As ControlCaption
If Object.Equals(NewValue, _Text) Then Return Me
_Text = NewValue
PreparePath()
MyBase.Invalidate(True)
Return Me
End Function
Protected Overrides Sub Control_SizeChanged(ByVal sender As Object, ByVal e As EventArgs)
PreparePath()
MyBase.Invalidate(True)
End Sub
Protected Overrides Sub PreparePath()
With _Control.Font
DrawPath.Reset()
DrawPath.AddString( _
_Text, .FontFamily, .Style, .Size * 1.4F, _Control.ClientRectangle, StringFormat)
End With
End Sub
Protected Overrides Sub Control_Paint(ByVal sender As Object, ByVal e As PaintEventArgs)
e.Graphics.SmoothingMode = SmoothingMode.HighQuality
MyBase.Control_Paint(sender, e)
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.