Setting font properties for printing
-
I can't figure out how to use the the system.drawing.font to set multple properties of a fontstyle. For example: Dim vbFont3 As New System.Drawing.Font("Century Schoolbook", 12, FontStyle.Bold) I would like to also be Italic. Anybody know how to do this? Jerry Hogan
-
I can't figure out how to use the the system.drawing.font to set multple properties of a fontstyle. For example: Dim vbFont3 As New System.Drawing.Font("Century Schoolbook", 12, FontStyle.Bold) I would like to also be Italic. Anybody know how to do this? Jerry Hogan
FontStyle is has a FlagsAttribute. This means that you can combine them using bit-wise operations, like And and Or, like this:
Dim vbFont3 As New Font("Century Schoolbook", 12, FontStyle.Bold Or FontStyle.Italic)
This will create a new Font that is both Bold AND Italic, despite the Or operator in there. Remember, it's a bit-wise OR. Not one or the other. Dave Kreskowiak Microsoft MVP - Visual Basic
-
FontStyle is has a FlagsAttribute. This means that you can combine them using bit-wise operations, like And and Or, like this:
Dim vbFont3 As New Font("Century Schoolbook", 12, FontStyle.Bold Or FontStyle.Italic)
This will create a new Font that is both Bold AND Italic, despite the Or operator in there. Remember, it's a bit-wise OR. Not one or the other. Dave Kreskowiak Microsoft MVP - Visual Basic