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.

Re: Assign Combined FontStyle on the fly by Kevin

Kevin
Tue Sep 19 15:16:41 CDT 2006

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.

"Liming" <lmxudotnet@gmail.com> wrote in message
news:1158692804.144603.150520@d34g2000cwd.googlegroups.com...
> 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.
>