- [DEVEXPRESS] Chia sẻ code các tạo report in nhiều hóa đơn trên XtraReport C#
- [POWER AUTOMATE] Hướng dẫn gởi tin nhắn zalo từ file Excel - No code
- [C#] Chia sẻ code lock và unlock user trong domain Window
- [SOFTWARE] Giới thiệu bộ phần mềm tính Kết Cấu Thép HatteSale, Mộng Đơn, Dầm, Sàn, Móng Cọc, Vách, Xà Gồ, Tính Tải Trọng
- [DEVEXPRESS] Vẽ Biểu Đồ Stock Chứng Khoán - Công Cụ Thiết Yếu Cho Nhà Đầu Tư trên Winform
- [C#] Hướng dẫn bảo mật ứng dụng 2FA (Multi-factor Authentication) trên Winform
- [C#] Hướng dẫn convert HTML code sang PDF File trên NetCore 7 Winform
- [C#] Hướng dẫn viết ứng dụng chat với Gemini AI Google Winform
- Hướng dẫn khóa file bằng nhiều process id, không cho xóa tập tin
- Hướng dẫn cách tạo Product Id cho ứng dụng phần mềm XXXXX-XXXXX-XXXXX-XXXXX
- [SQLSERVER] Hướng dẫn tạo script sql từ ứng dụng Sqlserver management Studio
- [C#] Hướng dẫn sử dụng thư viện AutoITx lấy id và password Ultraviewer trên winform
- [VB.NET] Hướng dẫn lấy thông tin tài khoản đăng nhập windows và khởi động lại ứng dụng ở chế độ Administrator
- [C#] Sử dụng thư viện Polly gửi lại request api khi request bị lỗi hay rớt mạng
- [DEVEXPRESS] Chia sẻ source code tạo báo cáo report in tem nhãn label trên C# winform
- [DEVEXPRESS] Hướng dẫn vẽ biểu đồ Bar Chart trên Winform
- [C#] Tạo form đăng nhập và đăng ký với hiệu ứng Sliding Animation Effect
- [C#] Hướng dẫn tạo thanh toán đơn hàng qua mã vạch VietQR sử dụng API PayOS hoàn toàn miễn phí
- [C#] Hướng dẫn ghi log ra RichTextBox giống Console trên Winform sử dụng thư viện Serilog
- [C#] Hướng dẫn cách tạo mã QR Code trên file Excel
[C#] Hướng dẫn sử dụng Font Awesome làm icon trong Winform
Xin chào các bạn, bài viết hôm nay mình sẽ tiếp tục hướng dẫn các bạn cách sử dụng Font Awesome để lấy icon cho phần mềm ứng dụng của mình trên ngôn ngữ lập trình C# Winform.
[C#] Tutorial Use FontAwesome in Winform
Font Awesome là một thư viện font bao gồm các icon phổ biến thường được sử dụng, do là icon font nên chúng ta sẽ dễ dàng thay đổi màu sắc và kích thước mà không làm bể điểm ảnh,
nghĩa là chúng ta zoom lớn hay nhỏ nó vẫn rõ nét.
Nếu các bạn nào đang lập trình website chắc cũng biết về bộ font nổi tiếng này, thường được sử dụng trong các website hiện nay.
Dưới đây là các icon của Font Awesome:
Còn rất là nhiều hình nằm ở bên dưới nữa nhé các bạn, bạn có thể truy cập vào trang chủ của FontAwesome để xem chi tiết.
Demo ứng dụng Winform C# sử dụng Font Awesome:
Đầu tiên, các bạn cần cài đặt thư viện font-awesome vào hệ thống của windows.
Trong thư mục Debug khi các bạn download source code ở cuối bài viết các bạn click mở file: fontawesome-webfont.ttf
để cài đặt vào thư viện font của windows.
Các bạn nhìn giao diện demo trên là các bạn thấy mình có thể thay đổi màu sắc một cách dễ dàng.
Trong bài viết có tích hợp sẵn một file font.cs
.
Cách sử dụng chèn Icon vào Listview:
private void Form1_Load( object sender, EventArgs e ) {
listView1.Font = Fonts.FontAwesome;
listView1.Items.Add( Fonts.fa.amazon );
listView1.Items.Add( Fonts.fa.google );
listView1.Items.Add( Fonts.fa.github_square );
listView1.Items.Add( Fonts.fa.hotel );
listView1.Items.Add( Fonts.fa.microphone );
listView1.Items.Add( Fonts.fa.motorcycle );
listView1.Items.Add( Fonts.fa.object_group );
listView1.Items.Add( Fonts.fa.send_o );
listView1.Items.Add( Fonts.fa.server );
listView1.Items.Add( Fonts.fa.list_alt );
listView1.Items.Add( Fonts.fa.map_signs);
listView1.Items.Add(Fonts.fa.child);
listView1.Items.Add(Fonts.fa.chevron_circle_right);
listView1.Items.Add(Fonts.fa.linux);
listView1.Items.Add(Fonts.fa.home);
listView1.Items.Add(Fonts.fa.soundcloud);
listView1.Items.Add(Fonts.fa.hourglass);
listView1.Items.Add(Fonts.fa.folder);
listView1.Items.Add(Fonts.fa.folder_open);
listView1.Items.Add(Fonts.fa.server);
listView1.Items.Add(Fonts.fa.list_alt);
listView1.Items.Add(Fonts.fa.television);
listView1.Items.Add(Fonts.fa.child);
listView1.Items.Add(Fonts.fa.chevron_circle_right);
listView1.Items.Add(Fonts.fa.linux);
listView1.Items.Add(Fonts.fa.home);
listView1.Items.Add(Fonts.fa.soundcloud);
listView1.Items.Add(Fonts.fa.hourglass);
listView1.Items.Add(Fonts.fa.folder);
listView1.Items.Add(Fonts.fa.folder_open);
listView1.Items.Add(Fonts.fa.server);
listView1.Items.Add(Fonts.fa.list_alt);
listView1.Items.Add(Fonts.fa.television);
}
private void btn_changeColor_Click(object sender, EventArgs e)
{
if(colorDialog1.ShowDialog() == DialogResult.OK)
{
listView1.ForeColor = colorDialog1.Color;
}
}
THANKS FOR WATCHING!