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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

multi-color column header

Thread ID:

Created:

Updated:

Platform:

Replies:

64643 Jul 23,2007 08:15 PM UTC Jul 24,2007 07:53 PM UTC WinForms 5
loading
Tags: GridControl
Eddie Jones
Asked On July 23, 2007 08:15 PM UTC

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 08:27 PM UTC

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,
Haneef

Eddie Jones
Replied On July 23, 2007 09:51 PM UTC

Great customer service as usual. Thanks.

Eddie Jones
Replied On July 23, 2007 10:00 PM UTC

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

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

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,
Haneef

Eddie Jones
Replied On July 24, 2007 07:53 PM UTC

Thanks, Haneef.

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

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

;