Windows Form Color Chooser C#.NET PROGRAM

Sample application, which we can use to find a color, along with RGB value, both in decimal, as Red, Green and Blue and in hexadecimal.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Windowscolorchoser
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            scrool_red.Value = 0;
            scroll_blue.Value = 0;
            scroll_green.Value = 0;
            UpDownRed.Value = 0;
            UpDownGreen.Value = 0;
            UpDownBlue.Value = 0;
            UpDownHexa.Value = 0;
            label9.BackColor = Color.FromArgb((int)UpDownRed.Value, (int)UpDownGreen.Value, (int)UpDownBlue.Value);
        }
       private void scrool_red_Scroll(object sender, ScrollEventArgs e)
        {
            UpDownRed.Value = scrool_red.Value;
            label9.BackColor = Color.FromArgb((int)UpDownRed.Value, (int)UpDownGreen.Value, (int)UpDownBlue.Value);
            UpDownHexa.Value = UpDownRed.Value * (int)Math.Pow(2, 16) + UpDownGreen.Value * (int)Math.Pow(2, 8) + UpDownBlue.Value;
        }
     private void scroll_green_Scroll(object sender, ScrollEventArgs e)
        {
            UpDownGreen.Value = scroll_green.Value;
            label9.BackColor = Color.FromArgb((int)UpDownRed.Value, (int)UpDownGreen.Value, (int)UpDownBlue.Value);
            UpDownHexa.Value = UpDownRed.Value * (int)Math.Pow(2, 16) + UpDownGreen.Value * (int)Math.Pow(2, 8) + UpDownBlue.Value;
        }
      private void scroll_blue_Scroll(object sender, ScrollEventArgs e)
        {
            UpDownBlue.Value = scroll_blue.Value;
            label9.BackColor = Color.FromArgb((int)UpDownRed.Value, (int)UpDownGreen.Value, (int)UpDownBlue.Value);
            UpDownHexa.Value = UpDownRed.Value * (int)Math.Pow(2, 16) + UpDownGreen.Value * (int)Math.Pow(2, 8) + UpDownBlue.Value;
        }
        private void UpDownRed_ValueChanged(object sender, EventArgs e)
        {
            scrool_red.Value = (int)UpDownRed.Value;
            label9.BackColor = Color.FromArgb((int)UpDownRed.Value, (int)UpDownGreen.Value, (int)UpDownBlue.Value);
            UpDownHexa.Value = UpDownRed.Value * (int)Math.Pow(2, 16) + UpDownGreen.Value * (int)Math.Pow(2, 8) + UpDownBlue.Value;
        }
      private void UpDownGreen_ValueChanged(object sender, EventArgs e)
        {
            scroll_green.Value = (int)UpDownRed.Value;
            label9.BackColor = Color.FromArgb((int)UpDownRed.Value, (int)UpDownGreen.Value, (int)UpDownBlue.Value);
            UpDownHexa.Value = UpDownRed.Value * (int)Math.Pow(2, 16) + UpDownGreen.Value * (int)Math.Pow(2, 8) + UpDownBlue.Value;
        }
      private void UpDownBlue_ValueChanged(object sender, EventArgs e)
        {
            scroll_blue.Value = (int)UpDownBlue.Value;
            label9.BackColor = Color.FromArgb((int)UpDownRed.Value, (int)UpDownGreen.Value, (int)UpDownBlue.Value);
            UpDownHexa.Value = UpDownRed.Value * (int)Math.Pow(2, 16) + UpDownGreen.Value * (int)Math.Pow(2, 8) + UpDownBlue.Value;
        }
      private void UpDownHexa_ValueChanged(object sender, EventArgs e)
        {
            int red = (int)UpDownHexa.Value / (int)Math.Pow(2, 16);
            int green = ((int)UpDownHexa.Value % (int)Math.Pow(2, 16) / (int)Math.Pow(2, 8));
            int blue = (((int)UpDownHexa.Value % (int)Math.Pow(2, 16)) % (int)Math.Pow(2, 8));
           
            label9.BackColor = Color.FromArgb(red, green, blue);
            label9.ForeColor = Color.FromArgb(red, green, blue);
            UpDownRed.Value = red;
            UpDownGreen.Value = green;
            UpDownBlue.Value = blue;
            scrool_red.Value = red;
            scroll_green.Value = green;
            scroll_blue.Value = blue;
        }
    }
}
OUTPUT 
 
Share:

Total Pageviews

CONTACT US

Prof. Roshan P. Helonde
Mobile: +917276355704
WhatsApp: +917276355704
Email: roshanphelonde@rediffmail.com

Enter Project Title

Popular Projects

All Archive

Contact Form

Name

Email *

Message *