private void p1_Click(object sender, EventArgs e) { try { PictureBox pb1 = sender as PictureBox; string strtag = pb1.Tag.ToString( ); ShowInf si = new ShowInf( ); string[] strinf = strtag.Split(','); Color col1 = Conf.HexToColor(strinf [0]); si.ColorName = Conf.HexToColor(strinf [0]); si.ColorId = strinf [0]; si.ColorNumber = strinf [1]; si.ReapetCount = strinf [2]; si.R = (( int )col1.R).ToString( ); si.G = (( int )col1.G).ToString( ); si.B = (( int )col1.B).ToString( ); HSLColor hl1 = HSLColor.FromRGB(col1); si.Hue = Math.Ceiling(col1.GetHue( )).ToString( ); si.Sat = Math.Ceiling(hl1.Saturation).ToString( ); si.Bright = ((col1.R + col1.G + col1.B) / 3).ToString( ); si.ShowDialog( ); } catch (Exception ex) { System.IO.File.AppendAllText(Application.StartupPath + "\\Error.txt", ex.Message.ToString( )); } }
private void dg2_CellClick(object sender, DataGridViewCellEventArgs e) { Color clr1 = Conf.HexToColor(dg2.CurrentRow.Cells [1].Value.ToString( )); try { ShowInf si = new ShowInf( ); si.ColorName = clr1; si.ColorId = clr1.Name.Substring(2).ToString(); si.ColorNumber = dg2.CurrentRow.Cells [0].Value.ToString( ); si.ReapetCount = dg2.CurrentRow.Cells [2].Value.ToString( ); si.R = (( int )clr1.R).ToString( ); si.G = (( int )clr1.G).ToString( ); si.B = (( int )clr1.B).ToString( ); HSLColor hl1 = HSLColor.FromRGB(clr1); si.Hue = Math.Ceiling(clr1.GetHue( )).ToString( ); si.Sat = Math.Ceiling(hl1.Saturation).ToString( ); si.Bright = ((clr1.R + clr1.G + clr1.B) / 3).ToString( ); si.ShowDialog( ); } catch (Exception ex) { System.IO.File.AppendAllText(Application.StartupPath + "\\Error.txt", ex.Message.ToString( )); } }