Fonts

The example in the previous section showed how to create a basic font for use in drawing a string on a form. You can also create fonts with formatting such as bold, italics, underline, and strikethrough. The object-oriented approach of the .NET Framework shows how easy it is to do things like this. You would simply create a new Font object and specify a font style in addition to the font name and size.

Here is an example showing several font styles:

 Imports System.Windows.Forms Imports System.Drawing Public Class Form1 Inherits System.Windows.Forms.Form Private Sub New() MyBase.New() End Sub Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) ...

Get Visual Basic® .NET by Example 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.