I've a colorPicker control in my grid. The issue comes when I try to use the value of the column. I want to use it with document reporting to set colours on a report. Issue is that I can't find a way to create an instance of Infragistics.Documents.Graphics.Color from the saved value.The value of the colour may either be RGB value or text! Ideally I would override to always save the RGB value not the text representation. Is there a way to do this? I don't care if it displays text representations to the user. It seems quite ridiculous that the value of ColorPicker control cannot be used to create an instance of Infragistics.Documents.Graphics.Color directly.All I want to do is the following : -headerCustomBackground = New Infragistics.Documents.Report.Background(New Infragistics.Documents.Graphics.Color([my colour picker value]))
I'm not sure that I understand the problem; you need to get a .NET Color object in order to create an Infragistics.Documents.Graphics.Color object. There is a Color property on the UltraColorPicker that you can use, or you can parse the RGB values from the Value property yourself.
-Matt
I don't have access to the colorPicker when I'm generating my report. All I have was the value that was saved to the database by the value property of colorPicker. i.e 'Color [Orange]' or, in the event that the color matches a default colour Color '[A=255, R=192, G=0, B=0]'
I've tried to create a .net color (system.drawing.color) from the value 'Color [Orange]' but this doesn't seem possible.
If I'm missing something obvisous please show me,
Thanks!
You have to convert the value in the database record to a System.Drawing.Color object. If you don't have control over the structure of the database table, and the ColorPickerEditor's value is being persisted to it as a string, there are ways to convert the string to a color (see System.Drawing.Color.FromArgb, System.Drawing.Color.FromName, etc. Once you have the System.Drawing.Color, you can use the Infragistics.Documents.Graphics.Color constructor that takes one.
I'm trying to get this to work look at the following and tell me where I'm going wrong. I don't get any exceptions but I still don't get the colour. If I hard code the colour from RGB it works as I can see the colour on my report. When I use the following it goes back to white!
NOTE: that dsTemplate1.Tables(0).Rows(0).Item("Colour")) has a value of 'Color [Olive]'
Dim myColour As New Infragistics.Documents.Graphics.Color(System.Drawing.Color.FromName(dsTemplate1.Tables(0).Rows(0).Item("Colour"))) headerCustomBackground = New Infragistics.Documents.Report.Background(myColour)
Can someone please provide a specific example to convert both values of format 'Color [A=255, R=234, G=123, B=125]' and 'Color [Orange]' to an actual instance of Infragistics.Documents.Graphics.Color?
I've tried System.Drawing.Color.FromName yet this does not give me anything!
The following does not work!
Dim dotNetColour As System.Drawing.Color = System.Drawing.Color.FromName(dsTemplate1.Tables(0).Rows(0).Item("Colour")) Dim myColour As New Infragistics.Documents.Graphics.Color(dotNetColour) headerCustomBackground = New Infragistics.Documents.Report.Background(myColour)