We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ColorEdit RGB

Hi, I have this problem: I have a ColorEdit cell in a GridControl (Not a GridGroupingControl). After a selection of a color, I want to get the RGB of the color but the BackColor property of the ColorEdit cell give R=255,G=255,B=255 with any color selected. How can I do? Thanks. Andrea

4 Replies

AD Administrator Syncfusion Team July 21, 2005 04:46 AM

If you set the CellValueType to be typeof(Color), then you can get a Color object as the cell value. gridControl1[rowIndex, colIndex].CellType = "ColorEdit"; gridControl1[rowIndex, colIndex].CellValue = Color.Aqua; gridControl1[rowIndex, colIndex].CellValueType = typeof(Color) //..... Color c = (Color)this.gridControl1[26,1].CellValue; Console.WriteLine(c); Console.WriteLine(c.R); Console.WriteLine(c.G); Console.WriteLine(c.B);


AV Andrea vignando July 21, 2005 06:42 AM

I tried but I still have the problem. In fact I''m developing under VB.Net (ad not C#) I try with gridControl1(4, 4).CellValueType = Color also gridControl1(4, 4).CellValueType = typeof(color) also gridControl1(4, 4).CellValueType = ctype(color) and so on... but does''t Work ("Color" is a type and cannot be used as expression...this is the error) Please, What I have to do? Andrea >If you set the CellValueType to be typeof(Color), then you can get a Color object as the cell value. > > >gridControl1[rowIndex, colIndex].CellType = "ColorEdit"; >gridControl1[rowIndex, colIndex].CellValue = Color.Aqua; >gridControl1[rowIndex, colIndex].CellValueType = typeof(Color) > >//..... > >Color c = (Color)this.gridControl1[26,1].CellValue; > >Console.WriteLine(c); >Console.WriteLine(c.R); >Console.WriteLine(c.G); >Console.WriteLine(c.B); >


AD Administrator Syncfusion Team July 21, 2005 06:51 AM

In VB, the code is: gridControl1(4, 4).CellValueType = GetType(Color) Just FYI, there is a C# to VB code coverter on this website that does a pretty good job on coverting snippets from C# to VB. http://authors.aspalliance.com/aldotnet/examples/translate.aspx


AV Andrea vignando July 21, 2005 07:01 AM

Thanks a lot!! It works!! I have also see the code converter, very very interesting!! By, Andrea >In VB, the code is: > >gridControl1(4, 4).CellValueType = GetType(Color) > > >Just FYI, there is a C# to VB code coverter on this website that does a pretty good job on coverting snippets from C# to VB. >http://authors.aspalliance.com/aldotnet/examples/translate.aspx >

Loader.
Live Chat Icon For mobile
Up arrow icon