combining FontStyle

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know this is probably an easy question. But in VB.Net when you instantiate
a fontstyle object, the parameter for fontstyle, if you wanted it to be Bold
and Italic, you would enter "FontStyle.Bold + FontStyle.Italics". But in C#,
it does not like that syntax. What is the proper syntax in C#?
 
FontStyle.Bold | FontStyle.Italics

| is the bitwise or operator, which is what is wanted when combining [Flags]
enums.

In fact *strictly* speaking in VB.Net you should be using "FontStyle.Bold Or
FontStyle.Italics", otherwise you risk getting screwy numbers if one enum
value automatically includes another.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Non Standard fontstyles 2
FontStyle Question 1
DrawItem event of combo box 0
FlagsAttribute 2
Fonts 4
FontStyle class 1
FontStyle Question 2
RichText Problems 3

Back
Top