PDA

View Full Version : ReportControl preview text color per item



Pieter van Dieren
5-Aug-2009, 08:41 AM
Does anyone know if it's possible to change the color of the PreviewText per item?

I know I can change the color of all preview items with the PreviewTextColor property. I also managed to change the fontname and/or size using the PreviewTextFont property.

However, there also is a PreviewItem property which returns a pointer to a ReportRecordItem. But if I then change the back or fore color of the record item, nothing happens.

Any idea?

Would it be a good idea to include the PreviewTextColor and PreviewTextFont properties in the Sig classes?

Ian Smith
15-Aug-2009, 07:19 AM
Hi Pieter

We have not done much with the preview!

To access an individual preview item try the following. I have not tested it.

You need to set a flag to enable an event. We have not used ComSetCustomDraw so it should be safe to just set the required flag.



Send ComSetCustomDraw to OLExtpCustomDrawPreviewItem

The above should cause the following event to fire. This will give you access to the preview item. From the Codejock help I assume that this ReportRecordItem is a copy. This would explain why changing the "main" item did not change the preview.



Procedure OnComDrawPreviewItem Variant llRow Variant llItem OLE_HANDLE llhDC Integer llleft Integer lltop Integer llright Integer llbottom Boolean ByRef llDoDefault
Handle hoItem

Get phoReportRecordItem to hoItem
Set pvComObject of hoItem to llItem

Set ComBackColor of hoItem to clRed
End_Procedure



Please let us know how you get on.