C # Font dialog box (fontdialog)

Source: Internet
Author: User

In word processing, we often use fonts, and now we're going to make the most common font dialog box.

Font dialog box (fontdialog) Common Properties Showcolor control whether the color options are displayed allowscriptchange whether font character set font is displayed in the dialog box font allowverticalfonts whether vertical fonts can be selected Color in the dialog box to select whether to display errors when the font does not exist MaxSize the maximum font size minsize selectable fontmustexist scriptsonly display excludes OEM and symbol fonts showapply Show the Apply button showeffects whether the underline, strikethrough, font color options ShowHelp Display the Help button

Second, the Font dialog box (FontDialog) event

Apply when you click the "Apply" button to handle events helprequest when you click on the "Help" button to handle events

Third, the implementation of the Code

private void Fontdialogbtn_click (object sender, System.EventArgs e)
{
FontDialog fontdialog=new FontDialog ();
Fontdialog.color=richtextbox1.forecolor;
Fontdialog.allowscriptchange=true;
Fontdialog.showcolor=true;
if (Fontdialog.showdialog ()!=dialogresult.cancel)
{
richtextbox1.selectionfont=fontdialog.font;//changes the text currently selected to a font
}
}

The above code sets the selected text to the font in the current FontDialog dialog box.

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.