How to get RGB value from the ColorDialog in C# .Net?



This code give the RGB value from the ColorDialog in c#.Net



//////////////////////////////////   CODE  ///////////////////////////////////

private void bnt_color_Click(object sender, EventArgs e)
        {
            ColorDialog cdlg = new ColorDialog();
            cdlg.ShowDialog();
            Color clr = cdlg.Color;
           
            String r = String.Empty;
            String g = String.Empty;
            String b = String.Empty;
            try
            {
              
                r = clr.R.ToString();
                g = clr.G.ToString();
                b = clr.B.ToString();
               
                // show the value in message box

                 MessageBox.Show("Red :"+ r +", Green :" + g +", Blue :"+ b);

             }
             catch (Exception ex)
                {
                    //doing nothing
                }

         }


/////////////////////////////////////////////////////////////////////////////////////////////


--
/\/ir@\/  <(.'.)>

Comments

Popular posts from this blog

How to make and use web service in Microsoft Dynamics Navision.

How to use Format function in Microsoft Dynamics Navision.

How to create simple report in Microsoft Dynamics Navision.