C
Charles Jenkins
I want to know if FontStyle.Bold is set in a font's Style property.
MS's help file is full of lovely examples of how to OR flags together in order to set the property, but as usual, seems to be missing the other half of the equation: How do you test the darned flags?
These tests all give me a compiler errors in C#:
FontStyle fs = myFont.Style;
bool isBold;
isBold = (( fs & FontStyle.Bold ) == FontStyle.Bold );
isBold = ( bool )( fs & FontStyle.Bold );
isBold = (( fs & FontStyle.Bold ) != 0 );
isBold = (( fs & ( ulong ) FontStyle.Bold ) == ( ulong ) FontStyle.Bold );
Casting and logical ANDing of the FlagsAttribute values does not seem to work, despite examples I have found on the Internet, such as the page at http://weblogs.asp.net/wim/archive/2004/04/07/109095.aspx
There must be a correct way to test the flags. Can anyone here share it with me?
MS's help file is full of lovely examples of how to OR flags together in order to set the property, but as usual, seems to be missing the other half of the equation: How do you test the darned flags?
These tests all give me a compiler errors in C#:
FontStyle fs = myFont.Style;
bool isBold;
isBold = (( fs & FontStyle.Bold ) == FontStyle.Bold );
isBold = ( bool )( fs & FontStyle.Bold );
isBold = (( fs & FontStyle.Bold ) != 0 );
isBold = (( fs & ( ulong ) FontStyle.Bold ) == ( ulong ) FontStyle.Bold );
Casting and logical ANDing of the FlagsAttribute values does not seem to work, despite examples I have found on the Internet, such as the page at http://weblogs.asp.net/wim/archive/2004/04/07/109095.aspx
There must be a correct way to test the flags. Can anyone here share it with me?