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.
Syncfusion Feedback

Is there any way to use a different PdfBrush per Column?

Thread ID:

Created:

Updated:

Platform:

Replies:

79491 Feb 11,2009 04:32 PM UTC Feb 13,2009 01:57 PM UTC Windows Forms 3
loading
Tags: PDF
Ken Nelson
Asked On February 11, 2009 04:32 PM UTC

Hi,

What I'm trying to do is use a different background color each column in a PdfLightTable. The BeginRowLayout event has a CellStyle.BackgroundBrush property in the event args that I can use to color each row differently, but the BeginCellLayout doesn't have a CellStyle property. I can't seem to figure out how to color a cell independently of a row. Am I missing something? This seems like it should be possible.

Thanks,
Ken


Bhuvaneswari P [Syncfusion]
Replied On February 12, 2009 02:19 PM UTC

Hi Ken,

Thank you for your interest in Syncfusion products.

I am working on this issue and will provide the details by tomorrow.

Best Regards,
Bhuvana


Bhuvaneswari P [Syncfusion]
Replied On February 13, 2009 11:42 AM UTC

Hi Ken,

We don't have direct option to set different background color each column in a PdfLightTable. But we can work around this by using the BeginCellLayout event. In this event we have cell RowIndex and CellIndex properties based on this we can format the column. Please refers to the below code snippet tod
C#
static int r = 0,i=10;
void table_BeginCellLayout(object sender, BeginCellLayoutEventArgs args)
{
if ((args.CellIndex) != r)
{
r = 0; i = 10;
}
if (r % 2 != 0)
{
PdfBrush brush = PdfBrushes.Magenta;
args.Graphics.DrawRectangle(brush, args.Bounds);
}
else
{
PdfBrush brush = PdfBrushes.Green;
args.Graphics.DrawRectangle(brush, args.Bounds);
}
r++; i = i + 20;
}

Please refers to the below sample to do so:
'>http://websamples.syncfusion.com//samples/Pdf.Windows/F79491/main.htm">
http://websamples.syncfusion.com//samples/Pdf.Windows/F79491/main.htm

You can change the sample as per your requirement. Please let me know if this helps you.

Best Regards,
Bhuvana



Ken Nelson
Replied On February 13, 2009 01:57 PM UTC

Ah I see, just overlap the cell background with a rectangle of whatver color I want. Yes that helps. Thanks!

Ken


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.

Warning Icon 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.Close Icon

;