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.

avoid column headers to be flat, sunken or raised

Thread ID:

Created:

Updated:

Platform:

Replies:

47428 Aug 4,2006 03:29 AM Aug 7,2006 01:07 AM Windows Forms 3
loading
Tags: Grouping
Mario
Asked On August 4, 2006 03:29 AM

I am working with a GridGroupingControl of the current version. The enclosed images shows what I try to achieve and what I currently have.

I have set Appearance.ColumnHeaderCell.CellAppearance to Flat.

This causes a white line to be drawn on top of all column header cells. This cuts off the first pixels of my background image.

How can I avoid this? I want my background image to be the only thing drawn for the header cells.

Thanks for your help.


Images11.zip

Administrator [Syncfusion]
Replied On August 4, 2006 07:54 AM

Hi Mario,

To resolve this issue, you need to use the TableControlDrawcell event to draw the line in the top of the column header cell in a grid. Please find the code snippet below

GridTableCellStyleInfo info = e.Inner.Style as GridTableCellStyleInfo;
if( info.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell )
{
e.Inner.Renderer.Draw(e.Inner.Graphics,e.Inner.Bounds,e.Inner.RowIndex,e.Inner.ColIndex,e.Inner.Style);
e.Inner.Cancel = true;

Pen yPen = new Pen("yourColor");
yPen.Width = 5;//For your requirement
e.Inner.Graphics.DrawLine(yPen,e.Inner.Bounds.Location,new Point(e.Inner.Bounds.X+ e.Inner.Bounds.Width, e.Inner.Bounds.Y) );

}

Thanks
Haneef

Mario
Replied On August 4, 2006 09:52 AM

Hi Haneef,
you describe, how I can write a line using the DrawCell event. However, what I would like to achieve is the opposite: I don''t want the white line on top of a flat column header to be drawn. In fact, I just want to see my background image in the column header, without any other stuff being drawn by the grid control.
My problem is, that I can only set the CellAppearance to Flat, Sunken or Raised. There is no option "None" to choose here.

Regards, Mario


>Hi Mario,

To resolve this issue, you need to use the TableControlDrawcell event to draw the line in the top of the column header cell in a grid. Please find the code snippet below

GridTableCellStyleInfo info = e.Inner.Style as GridTableCellStyleInfo;
if( info.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell )
{
e.Inner.Renderer.Draw(e.Inner.Graphics,e.Inner.Bounds,e.Inner.RowIndex,e.Inner.ColIndex,e.Inner.Style);
e.Inner.Cancel = true;

Pen yPen = new Pen("yourColor");
yPen.Width = 5;//For your requirement
e.Inner.Graphics.DrawLine(yPen,e.Inner.Bounds.Location,new Point(e.Inner.Bounds.X+ e.Inner.Bounds.Width, e.Inner.Bounds.Y) );

}

Thanks
Haneef

Administrator [Syncfusion]
Replied On August 7, 2006 01:07 AM

Hi Mario,

Please try this code snippet to resolve this issue.

this.grid.TableModel.Properties.Buttons3D = false;

Let me know if this helps.
Best Regards,
Haneef.

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.

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.

;