Count Line in Multiline Label Control
My New Task
Count Total Number Lines in Label Control.
Function LineCount(ByVal Label As Label) As Integer
Dim g As Graphics = Label.CreateGraphics
Dim LineHeight As Single = g.MeasureString("X", Label.Font).Height))
Dim TotalHeight As Single = g.MeasureString(Label.Text, Label.Font, Label.Width).Height
Return CInt(Math.Round(TotalHeight / LineHeight))
End Function
Comments
Post a Comment