0% found this document useful (0 votes)
820 views15 pages

Modern Form + Font Awesome Icons, WinForm, C # - VB - Net - RJ Code Advance

This document provides a tutorial on creating a modern user interface for desktop applications in C# and VB.NET using Windows Forms. It demonstrates how to design a colorful button, text, and icon interface using Font Awesome icons. The tutorial shows how to implement functionality like resizing, dragging, maximizing, restoring, minimizing and closing the main form. It also discusses opening secondary forms and highlighting the active button by changing its color.

Uploaded by

Toan Nguyen Manh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
820 views15 pages

Modern Form + Font Awesome Icons, WinForm, C # - VB - Net - RJ Code Advance

This document provides a tutorial on creating a modern user interface for desktop applications in C# and VB.NET using Windows Forms. It demonstrates how to design a colorful button, text, and icon interface using Font Awesome icons. The tutorial shows how to implement functionality like resizing, dragging, maximizing, restoring, minimizing and closing the main form. It also discusses opening secondary forms and highlighting the active button by changing its color.

Uploaded by

Toan Nguyen Manh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.

NET - RJ Code Advance

Modern Form + Font Awesome


Icons, WinForm, C # - VB.NET
by RJ Code Advance / 25 comments

Hello everyone, today I bring you a new tutorial on user interface design, modern and
multicolored, both in the button, text and icons, with the option to keep the button
highlighted and show the title and icon when the secondary form is open . In addition to
implementing all the functionalities of resizing, dragging the form, maximizing, restoring,
minimizing and closing the form. You may be wondering how it is possible to change the
color of the icons. Well this is thanks to FONT AWESOMEIn general summary, this tool allows
you to create icons based on vectors to CSS from a text font format, I'm sure many of you
have used it when creating web pages or applications, where it is really easy to place icons
with a color and custom size. There are other web fonts, however they are all for inclusion in
web pages and style sheets only. Then one day it occurred to me why not integrate into
desktop applications, after all they are only web sources and we can convert to image

https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 1/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

format, but others had already thought about it, I found a library in the NUGET packages,
under the name of FONTAWESOME.SHARP , developed by mkoertgen and ThomasMentzel.
Well, this package is very interesting, with all the required options, and I liked the ease of
adding icons with custom colors and sizes in our desktop applications.

All this in C # language and Visual Basic .NET with Windows Form.

MainMenu.cs / vb

C# VB

public partial class FormMainMenu: Form


{
// Fields
private IconButton currentBtn;
private Panel leftBorderBtn;
private Form currentChildForm;

//Builder
public FormMainMenu ()
{
InitializeComponent () ;
leftBorderBtn = new Panel () ;
leftBorderBtn. Size = new Size ( 7 , 60 ) ;
panelMenu. Controls . Add ( leftBorderBtn ) ;
// Form
this . Text = string. Empty ;
this . ControlBox = false ;
this . DoubleBuffered = true ;
this . MaximizedBounds = Screen. FromHandle ( this . Handle ) . Worki
}
// Structs
private struct RGBColors
{
public static Color color1 = Color. FromArgb ( 172 , 126 , 241 ) ;
public static Color color2 = Color. FromArgb ( 249 , 118 , 176 ) ;
public static Color color3 = Color. FromArgb ( 253 , 138 , 114 ) ;
public static Color color4 = Color. FromArgb ( 95 , 77 , 221 ) ;
public static Color color5 = Color. FromArgb ( 249 , 88 , 155 ) ;
public static Color color6 = Color. FromArgb ( 24 , 161 , 251 ) ;

// Methods
private void ActivateButton ( object senderBtn, Color color )
{
if ( senderBtn! = null )
{
https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 2/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

DisableButton () ;
// Button
currentBtn = ( IconButton ) senderBtn;
currentBtn. BackColor = Color. FromArgb ( 37 , 36 , 81 ) ;
currentBtn. ForeColor = color;
currentBtn. TextAlign = ContentAlignment. MiddleCenter ;
currentBtn. IconColor = color;
currentBtn. TextImageRelation = TextImageRelation. TextBeforeImag
currentBtn. ImageAlign = ContentAlignment. MiddleRight ;
// Left border button
leftBorderBtn. BackColor = color;
leftBorderBtn. Location = new Point ( 0 , currentBtn. Location .
leftBorderBtn. Visible = true ;
leftBorderBtn. BringToFront () ;
// Current Child Form Icon
iconCurrentChildForm. IconChar = currentBtn. IconChar ;
iconCurrentChildForm. IconColor = color;
}
}

private void DisableButton ()


{
if ( currentBtn! = null )
{
currentBtn. BackColor = Color. FromArgb ( 31 , 30 , 68 ) ;
currentBtn. ForeColor = Color. Gainsboro ;
currentBtn. TextAlign = ContentAlignment. MiddleLeft ;
currentBtn. IconColor = Color. Gainsboro ;
currentBtn. TextImageRelation = TextImageRelation. ImageBeforeTex
currentBtn. ImageAlign = ContentAlignment. MiddleLeft ;
}
}

private void OpenChildForm ( Form childForm )


{
// open only form
if ( currentChildForm! = null )
{
currentChildForm. Close () ;
}
currentChildForm = childForm;
// End
childForm. TopLevel = false ;
childForm. FormBorderStyle = FormBorderStyle. None ;
childForm. Dock = DockStyle. Fill ;
panelDesktop. Controls . Add ( childForm ) ;
panelDesktop. Tag = childForm;
childForm. BringToFront () ;
childForm. Show () ;
https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 3/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

lblTitleChildForm. Text = childForm. Text ;


}

private void Reset ()


{
DisableButton () ;
leftBorderBtn. Visible = false ;
iconCurrentChildForm. IconChar = IconChar. Home ;
iconCurrentChildForm. IconColor = Color. MediumPurple ;
lblTitleChildForm. Text = "Home" ;
}

// Events
// Reset
private void btnHome_Click ( object sender, EventArgs e )
{
if ( currentChildForm! = null )
{
currentChildForm. Close () ;
}
Reset () ;
}
// Menu Button_Clicks
private void btnDashboard_Click ( object sender, EventArgs e )
{
ActivateButton ( sender, rgbColors. Color1 ) ;
OpenChildForm ( new FormDashboard ()) ;
}

private void btnOrder_Click ( object sender, EventArgs e )


{
ActivateButton ( sender, rgbColors. Color2 ) ;
OpenChildForm ( new FormOrders ()) ;
}

private void btnProduct_Click ( object sender, EventArgs e )


{
ActivateButton ( sender, rgbColors. Color3 ) ;
OpenChildForm ( new FormProducts ()) ;
}

private void btnCustomer_Click ( object sender, EventArgs e )


{
ActivateButton ( sender, RGBColors. Color4 ) ;
OpenChildForm ( new FormCustomers ()) ;
}

private void btnMarketing_Click ( object sender, EventArgs e )


{
https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 4/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

ActivateButton ( sender, RGBColors. Color5 ) ;


OpenChildForm ( new FormMarketing ()) ;
}

private void btnSetting_Click ( object sender, EventArgs e )


{
ActivateButton ( sender, RGBColors. Color6 ) ;
OpenChildForm ( new FormSetting ()) ;
}

// Drag Form
[ DllImport ( "user32.DLL" , EntryPoint = "ReleaseCapture" )]
private extern static void ReleaseCapture () ;

[ DllImport ( "user32.DLL" , EntryPoint = "SendMessage" )]


private extern static void SendMessage ( System. IntPtr hWnd, int wMsg, i

private void panelTitleBar_MouseDown ( object sender, MouseEventArgs e )


{
ReleaseCapture () ;
SendMessage ( this . Handle , 0x112 , 0xf012 , 0 ) ;
}

// Close-Maximize-Minimize
private void btnExit_Click ( object sender, EventArgs e )
{
Application. Exit () ;
}

private void btnMaximize_Click ( object sender, EventArgs e )


{
if ( WindowState == FormWindowState. Normal )
WindowState = FormWindowState. Maximized ;
else
WindowState = FormWindowState. Normal ;
}

private void btnMinimize_Click ( object sender, EventArgs e )


{
WindowState = FormWindowState. Minimized ;
}

// Remove transparent border in maximized state


private void FormMainMenu_Resize ( object sender, EventArgs e )
{
if ( WindowState == FormWindowState. Maximized )
FormBorderStyle = FormBorderStyle. None ;
else
FormBorderStyle = FormBorderStyle. Sizable ;
https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 5/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

See Video Tutorial

C#

C#/ IU Moderno + Iconos Font Awesome, Multicolor, Resaltar botón, WinForm,…


WinForm,…

VB .NET

VB/ Form Moderno + Iconos Font Awesome, Multicolor, Resaltar botón, WinFo…
WinFo…

https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 6/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

25 comments on "Modern Form + Font


Awesome Icons, WinForm, C # - VB.NET"

REYNALDO HERNANDEZ
January 13, 2020 at 3:12 pm

Hello good morning, first of all thank you for your videos since they are of great help and
contribution to the vb community, well I would like to propose that you create a project
where we can send messages by WhatsApp from our vb application, since this is from fashion
today and it is very important to have something like this integrated into our projects, Thank
you.

Answer

REYNALDO HERNANDEZ
January 13, 2020 at 3:38 pm

I saw an example in this forum:

https://foro.elhacker.net/net/vbnet_porteo_de_la_implementacion_del_api_de_whatsapinet
_whatsapp_whatsappapi-t419188.0.html

VB / MODERN FORM + FONT AWESOME ICONS, MULTICOLOR, HIGHLIGHT BUTTON, WINFORM-


VISUAL BASIC .NET - TRUMPATHON - NEWS AND INFORMATION ON LATEST TOP STORIES,
WEATHER, BUSINESS, ENTERTAINMENT, POLITICS,
January 17, 2020 at 6:54 am

[…] Modern Form + Font Awesome Icons, WinForm, C # - VB.NET […]


https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 7/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

Answer

SEO COMPANY
January 24, 2020 at 2:17 pm

Awesome post! Keep up the great work!

Answer

RICARDO MESA
on April 2, 2020 at 5:49 pm

Hello, thanks for your tutorial videos, they are the best I have seen on the internet (My
Personal Criterion), I need that if you can do a tutorial how to open pdf documents in a form,
but be careful that it is already in the form resources, example that when I click on a label
for example to open the pdf document in the form, thank you very much in advance… ..

Answer

FREEPORNPICS
on April 5, 2020 at 2:09 pm

I wish mankind victory over disease

Answer

EDSON MONTEIRO
April 26, 2020 at 7:50 pm

Awesome post! Thank you.

What software did you use to read the texts?

Answer

钻网
April 30, 2020 at 1:58 am

https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 8/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

春暖花开 , 下次 再来!

Answer

言情小说
May 6, 2020 at 2:27 am

学习 啦 , 很久 没 浏览 过 了!

Answer

FREDD
May 21, 2020 at 11:12 am

Hello,

Thanks for this tutorial, Someone has project files for this? In VB.Net

And would like to make a request for a job to make and finish my ACARS Project.

With this UI Forms Thanks

Regards Fred

Answer

PORNLIST
on June 15, 2020 at 11:56 pm

This is a good blog, happy every day

Answer

GABRIEL M.
June 22, 2020 at 4:50 am

Hi RJ. I congratulate you for the tutorial, I am starting in programming and you really explain
it very easily. But I have a problem when I click any of the buttons.

System.NullReferenceException

HResult = 0x80004003

Message = Object reference not set as an instance of an object.

Source = Commissions

https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 9/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

Stack Tracking:

at Commissions.frmMenuPrincipal.ActivateButton (Object senderBtn, Color customColor) in


frmMenuPrincipal.vb: line 34

——> this is line 34 (leftBorderBtn.BackColor = customColor)

Thanks for the help.

Answer

GABRIEL M.
June 22, 2020 at 4:20 pm

Thanks. Problem solved. A typo of mine.

PORN PICS
June 25, 2020 at 12:27 am

Looks good! I like this!

Answer

择偶 网
on July 15, 2020 at 1:20 pm

这个 不错 耶 , 我 喜欢!

Answer

SPARTANHOST
on August 3, 2020 at 2:49 am

The server is very fast.

Answer

https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 10/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

进球 库
on August 8, 2020 at 8:39 am

初 来 乍 到 , 多多 关照! 消灭 新 冠 , 人人 平安!

Answer

PORNPICS.WIN
on October 11, 2020 at 11:41 pm

COVID-19 is raging.

Are you ok

Answer

Pingback:  Google

Pingback:  Google

PORNPICS
On November 16, 2020 at 12:21 pm

Wish you good health, dear

Answer

择偶 网
on December 1, 2020 at 1:48 am

新 冠 肆虐 , 注意 安全!

Answer

PORNPICS
December 12, 2020 at 1:21 pm

Wish You All The Best In 2021!

https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 11/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

Answer

言情 库
December 23, 2020 at 2:43 am

不 知道 说什么好, 还是 祝 疫情 早点 结束 吧!

Answer

_NOOKER
on July 16, 2021 at 3:04 am

Good crack greetings a question I would like to know what library you used to put the part
where you translate code the black box that remains github style greetings crack from
chihuahua mexico

Answer

Leave a reply
Your email address will not be published. Required fields are marked with *

Commentary

Name *

https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 12/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

E-mail *

Web

Post the comment

Welcome to blog

Look for …

Follow me




Category:
.NET
ASP .NET
C#
Mistakes
F#
Visual basic
Windows Forms
Layered Architecture
Database

https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 13/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

MySQL
SQL Server
Custom controls
courses
.NET (Course)
Create .Net Installer
Full Login C #, VB, SQL Server
Software Patterns (Course)
OOP (Course)
Desk
GUI
Software Patterns
OOP
Uncategorized
Web

Recent logins
Circular Picture Box - Border Gradient color + Styles - C # & WinForms
Custom ProgressBar - WinForms & C #
Custom TextBox Full - Rounded & Placeholder - WinForm, C #
Custom ComboBox - Icon, Back, Text & Border Color - WinForm C #
Custom Text Box - Custom controls WinForm C #

Recent comments
gustavo on Custom Button - Custom controls WinForm C #
_Nooker in Modern Form + Font Awesome Icons, WinForm, C # - VB.NET
Impekly in Full Login + CRUD - C #, SQL Server- Advanced Level
Willgt27 in Login Cap 2- Start Session, Close Session and Show user data with C #, VB.Net,
Sql Server, WinForm- POO, Layered Architecture- Intermediate Level
Juan Vega in Chapter 4 / Create Installation Package - Application with Local Network
Database (LAN-MAN) - SQL Server, Visual Studio, WinForm, Layers

https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 14/15
7/22/2021 Modern Form + Font Awesome Icons, WinForm, C # - VB.NET - RJ Code Advance

Terms and Conditions Privacy Policy Cookies policy




© 2021 RJ Code Advance - All Rights Reserved

https://rjcodeadvance.com/formulario-modernoiconos-font-awesome-winform-c/ 15/15

You might also like