Strings
Of course, deciding on a font is only half the fun. The real action is drawing strings after the font's been picked. For that, you use the DrawString method of the Graphics object:
Dim myfont As Font = New Font("Arial", 12) ' This will wrap at new line characters g.DrawString("line 1" & vbCrLf & "line 2", myfont, _ Brushes.Black, 10, 10)
Measure | Units | Example | Description |
---|---|---|---|
FontFamily.GetEmHeight | Design Units | 2,048 | Base size, equivalent to Size |
FontFamily.GetCellAscent | Design Units | 1,854 | Height above base line |
FontFamily.GetCellDescent | Design Units | 434 | Height below base line |
FontFamily.GetLineSpacing | Design Units | 2,355 | CellAscent + CellDescent + Leading, normally about 115% of ... |
Get Windows Forms Programming in Visual Basic .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.