Background color on textfield, color defined in datasource.

Stimulsoft Reports.NET discussion
Post Reply
malbrigt
Posts: 3
Joined: Thu Mar 31, 2011 8:54 am

Background color on textfield, color defined in datasource.

Post by malbrigt »

I need to set the background-color of a textfield with a color given from my datasource. The textfield (datasource value) is on a databand.

I'm using the latest prerelease, designing with WebDesigner.Silverlight.

Any ideas?


Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Background color on textfield, color defined in datasource.

Post by Jan »

Hello,

Can you provide any sample in which format colors stored in your database? For example: Blacm, Red or 0xffffff or somethin also?

Thank you.
malbrigt
Posts: 3
Joined: Thu Mar 31, 2011 8:54 am

Background color on textfield, color defined in datasource.

Post by malbrigt »

Thanks for replying.

I'm using rgb hex values for colors (0xRRGGBB), if there's a more convenient format I can change the data source XML.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Background color on textfield, color defined in datasource.

Post by Ivan »

Hello,

You can use the following code in the BeforePrint event of databand, for example:

Code: Select all

Text1.Brush = new StiSolidBrush(Color.FromArgb((int)(0xFF000000 | DataSource.ColorField)));
Please check the report sample in the attachment.

Thank you.
Attachments
901.Report sample.zip
(2.67 KiB) Downloaded 282 times
malbrigt
Posts: 3
Joined: Thu Mar 31, 2011 8:54 am

Background color on textfield, color defined in datasource.

Post by malbrigt »

Thanks alot Ivan, that worked! :biggrin:
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Background color on textfield, color defined in datasource.

Post by Andrew »

Great!

Have a nice day!
Post Reply