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. Image for the cookie policy date

avoid column headers to be flat, sunken or raised

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

3 Replies

AD Administrator Syncfusion Team August 4, 2006 11:54 AM UTC

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


MA Mario August 4, 2006 01:52 PM UTC

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


AD Administrator Syncfusion Team August 7, 2006 05:07 AM UTC

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.

Loader.
Live Chat Icon For mobile
Up arrow icon