C# - Design Login Form

How To Design a Login Form In C#

Design Login Form In C#


In This C# Tutorial We Will See How To Make a Login Form Design Using Panels, Buttons, Labels, Textboxes and a checkbox in C# Windows Form Application Using Visual Studio Editor .



WATCH THIS C# TUTORIAL


Project Source Code:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Csharp_Tutorials
{
    public partial class Login_From_Design : Form
    {
        public Login_From_Design()
        {
            InitializeComponent();
        }

        // form load
        private void Login_From_Design_Load(object sender, EventArgs e)
        {
            // panels background color
            panel1.BackColor = Color.FromArgb(200, 255, 255, 255);
            panel2.BackColor = Color.FromArgb(142, 68, 173);

            // labels background color and forcolor
            label1.BackColor = Color.Transparent;
            label1.ForeColor = Color.White;

            label2.BackColor = Color.Transparent;
            label3.BackColor = Color.Transparent;

            // textboxes background color and forcolor
            textBoxU.BackColor = Color.FromArgb(149, 165, 166);
            textBoxP.BackColor = Color.FromArgb(149, 165, 166);

            textBoxU.ForeColor = Color.FromArgb(255, 255, 255);
            textBoxP.ForeColor = Color.FromArgb(255, 255, 255);

           // checkBox background color
            checkBox1.BackColor = Color.Transparent;

            // set button flat style
            buttonLogin.FlatStyle = FlatStyle.Flat;

            // set the background color for the button
            buttonLogin.BackColor = Color.FromArgb(46, 204, 113);

            // set the button border color
            buttonLogin.FlatAppearance.BorderColor = Color.White;

            // set the button forColor
            buttonLogin.ForeColor = Color.White;

            // set label background color to transparent
            label4.BackColor = Color.Transparent;

            // set buttons background color to transparent
            buttonClose.BackColor = Color.Transparent;
            buttonMinimize.BackColor = Color.Transparent;
           
            // set buttons style to flat
            buttonClose.FlatStyle = FlatStyle.Flat;
            buttonMinimize.FlatStyle = FlatStyle.Flat;

            // textboxes background color
            textBoxU.BackColor = Color.FromArgb(44, 62, 80);
            textBoxP.BackColor = Color.FromArgb(44, 62, 80);
        }

        // button close
        private void buttonClose_Click(object sender, EventArgs e)
        {

            Close();

        }

        // button minimize
        private void buttonMinimize_Click(object sender, EventArgs e)
        {

            WindowState = FormWindowState.Minimized;

        }

        // checkBox to show and hide the password chars
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                textBoxP.UseSystemPasswordChar = false;
            }
            else
            {
                textBoxP.UseSystemPasswordChar = true;
            }
        }

        // button close mouse enter
        private void buttonClose_MouseEnter(object sender, EventArgs e)
        {
            buttonClose.BackColor = Color.FromArgb(200, 44, 62, 80);
            buttonClose.FlatAppearance.BorderColor = Color.Yellow;
            buttonClose.ForeColor = Color.Yellow;
        }

        // button close mouse leave
        private void buttonClose_MouseLeave(object sender, EventArgs e)
        {
            buttonClose.BackColor = Color.Transparent;
            buttonClose.FlatAppearance.BorderColor = Color.Black;
            buttonClose.ForeColor = Color.Black;
        }

        // button minimize mouse enter
        private void buttonMinimize_MouseEnter(object sender, EventArgs e)
        {
            buttonMinimize.BackColor = Color.FromArgb(200, 44, 62, 80);
            buttonMinimize.FlatAppearance.BorderColor = Color.Yellow;
            buttonMinimize.ForeColor = Color.Yellow;
        }

        // button minimize mouse leave
        private void buttonMinimize_MouseLeave(object sender, EventArgs e)
        {
            buttonMinimize.BackColor = Color.Transparent;
            buttonMinimize.FlatAppearance.BorderColor = Color.Black;
            buttonMinimize.ForeColor = Color.Black;
        }
    }
}



OUTPUT:


How To Design a Login Form Using C#




Aucun commentaire:

Enregistrer un commentaire