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