C # in font &~ Use

Source: Internet
Author: User
& Is a binary bitwise AND operator;
~ Is a binary bitwise inverse operator.

Generation: If (Oldfont. Bold)
{
// If it is a black image, the system removes the manual configuration.
Newfont =   New Font (oldfont, oldfont. Style &   ~ Fontstyle. Bold );
}
Else
{
// If it is not a hacker, add the hacker
Newfont =   New Font (oldfont, oldfont. Style | Fontstyle. Bold );
}

Solution:
In fact, fontstyle is a binary number. Assume that the first digit is italic, that is, 000001 is italic, and the second digit is bold, that is, 000010 is bold, and 000011 is bold and oblique.
First, we get the inverse of 000010 in bold, and then we get 111101, and then perform bitwise AND with a style. The characteristic of bitwise AND is that if one of the first and second binary numbers is 1, the result is 1. Obviously, if any number and 111101 are bitwise, the result is 0 at the second position, which achieves the effect of removing the black body.

Http://topic.csdn.net/t/20061119/17/5169316.html:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.