Friday, 12 October 2012

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@\/  <(.'.)>

0 comments:

Post a Comment

Thanks for comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
Toggle Footer