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.
Unfortunately, activation email could not send to your email. Please try again.

ColorEdit RGB

Thread ID:

Created:

Updated:

Platform:

Replies:

32067 Jul 21,2005 04:44 AM Jul 21,2005 08:01 AM Windows Forms 4
loading
Tags: GridControl
Andrea vignando
Asked On July 21, 2005 04:44 AM

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

Administrator [Syncfusion]
Replied On July 21, 2005 05: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);

Andrea vignando
Replied On July 21, 2005 07: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); >

Administrator [Syncfusion]
Replied On July 21, 2005 07: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

Andrea vignando
Replied On July 21, 2005 08: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 >

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;