How to Use Font Awesome in window Form ?, Fontawesome

Source: Internet
Author: User

How to Use Font Awesome in window Form ?, Fontawesome

With the development of technology, the previous image buttons on the web are now gradually replaced with the icon font, Which is vector, and the vector map means that each icon can be perfectly displayed on all sizes of the screen, you can change the size and color at any time without any distortion. It truly gives you a feeling of being tall. Since Font Awesome is completely free of charge, it is widely used in both personal and commercial scenarios. A Font Awesome Font file contains many practical icons, which can help you fully express the meaning of each action on the web page (the figure is better than the table and the table is better than the text ).

Font Awesome is a complete set of icons designed from the ground up and fully compatible with Bootstrap. They are a good partner. You can use CSS very convenient to use, Font Awesome of the Font encoding (http://fontawesome.io/3.2.1/cheatsheet/) reflected as shown in:

But what's the problem? How to use it in the Winform interface (of course, WPF is also acceptable ). After some research, I finally found out the "Mysteries ":

The procedure is as follows:

1. Download Font Awesome to the local device and install and modify the Font. The FontAwesome is called the FontAwesome.

2. Create a winform Application and Design it on the Form interface as follows:

The Code is as follows:

1 using System; 2 using System. collections. generic; 3 using System. componentModel; 4 using System. data; 5 using System. drawing; 6 using System. linq; 7 using System. text; 8 using System. windows. forms; 9 10 namespace WinFormFont11 {12 public partial class IconFontDemo: Form13 {14 public IconFontDemo () 15 {16 InitializeComponent (); 17 // unicode Code 18 this. label1.Text = "\ uF028"; 19 this. label1.Font = new Font ("FontAwesome", 16); 20 this. label1.ForeColor = Color. green; 21 // The unicode code 22 this. textBox1.Text = "\ uF029 jackwangcumt"; 23 this. textBox1.Font = new Font ("FontAwesome", 16); 24 this. textBox1.ForeColor = Color. black; 25} 26 27 private void button#click (object sender, EventArgs e) 28 {29 int fontsize = int. parse (this. textBox2.Text); 30 this. label1.Font = new Font ("FontAwesome", fontsize); 31 this. textBox1.Font = new Font ("FontAwesome", fontsize); 32} 33} 34}

3. The interface is as follows:

Change the font size and click Refresh. You can see that the font icons have become larger:

How to obtain the font code:

You can use the insert symbol in word, select the font, and click the desired icon to view the unicode code below:

 

Related Article

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.