Assign Combined FontStyle on the fly

  • Thread starter Thread starter Liming
  • Start date Start date
L

Liming

Hi all,

I know for fontStyle, I can specify FlagAttribute to get a combone
FontStyle like so

FontStyle.Bold | FontStyle.Underline

The problem I'm having is, depending on what users clicked, I need to
dynamically concate the FontStyle together.

How do I do that?

FontStyle fontstyle;

if (Bold.Checked)
{
}
if (UnderLine.Checked)
{
}
If (Italic.Checked)
{
}

Font myFont = new Font (.... , fontstyle, )

Thanks a lot.
 
Use the |= ("OrEquals") operator.

--
HTH,

Kevin Spencer
Microsoft MVP
Digital Carpenter

A man, a plan, a canal,
a palindrome that has gone to s**t.
 
Back
Top