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 09:46 AM UTC

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 11:42 AM UTC

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 11:51 AM UTC

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 12:01 PM UTC

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.
Up arrow icon