Pdf sharp font style Bold,Italic and Underline together
Asked Answered
A

1

10

Have any way set font style ItalicUnderline or BoldItalicUnderline? enter image description here

Thanks

Afterworld answered 21/7, 2012 at 7:56 Comment(0)
C
17

XFontStyle is an enum type. You can use bitwise logic to combine values.

const XFontStyle ItalicUnderline = XFontStyle.Italic | XFontStyle.Underline ;

const XFontStyle BoldItalicUnderline = XFontStyle.Bold | XFontStyle.Italic | XFontStyle.Underline ;
Carlisle answered 21/7, 2012 at 8:8 Comment(4)
Seems strange (to me) to use OR rather than AND, but it works, thanks.Reseau
@Henk: bitwise logic is not available for all enumerations. Flags attribute is required on the enum definition (which is ok for XFontStyle)Extenuate
@BernhardHofmann: Don't confuse bitwise logic with boolean logic. Every bit in the value has a different meaning. The 1st bit defines bold, the 2nd bit defines italic, etc. The '|' (bitwise OR) combines values by applying the operator to each bit of the same index and if you want to combine binary values "1000" and "0100" you need to use OR to get "1100". Bitwise AND (&) would return "0000".Extenuate
@Extenuate - sorry for the late response but [Flags] is irrelevant. It only affects ToString(). The essential part is a 1,2,4,8,16 numbering.Carlisle

© 2022 - 2024 — McMap. All rights reserved.