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.

multi-color column header

Thread ID:





64643 Jul 23,2007 04:15 PM Jul 24,2007 03:53 PM Windows Forms 5
Tags: GridControl
Eddie Jones
Asked On July 23, 2007 04:15 PM

I'm using a GridDataBoundGrid and would like to change the column header text to display in more than one color.

For example, if the column header was "* Plan ID", I want "*" to be red while "Plan ID" is black.

Any ideas? Thanks.

haneefm [Syncfusion]
Replied On July 23, 2007 04:27 PM

Hi Eddie,

You can do this by handling the DrawCell event of the grid and set e.Cancel to true to customize your drawing in a grid cell. Below is a code snippet that show this task.

void gridDrawCell(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs e)
if (e.ColIndex == 2 && e.RowIndex == 0)
e.Cancel = true;
e.Renderer.Draw(e.Graphics, e.Bounds, e.RowIndex, e.ColIndex, e.Style);
e.Graphics.DrawString("**", e.Style.GdipFont, new SolidBrush(Color.Red), e.Bounds);

Best regards,

Eddie Jones
Replied On July 23, 2007 05:51 PM

Great customer service as usual. Thanks.

Eddie Jones
Replied On July 23, 2007 06:00 PM

One other thing -- when I hover over the column header with the mouse, the asterisk disappears.

haneefm [Syncfusion]
Replied On July 23, 2007 06:33 PM

Hi Eddie,

Thank you for your update.

I am afraid that i was not able to reproduce the issue in your sample. Also i have created a simple sample to test this issue and it is available in the following link,.

Sample : GDBGHeaderDrawing.zip

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample or send us the reproducing steps that we could sort out the cause of the issue and provide you a solution?

Best regards,

Eddie Jones
Replied On July 24, 2007 03:53 PM

Thanks, Haneef.

I got it working. I had the order of the DrawString and Draw methods reversed.


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.