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
close icon

column header in syncfusion grouping control

How do I get rid of the white line in the column
header cell which ends up truncating the
column header text in the syncfusion grouping control.
I am using version 4.1.0.50

thanks,
prem

8 Replies

AD Administrator Syncfusion Team August 11, 2006 09:50 AM UTC

Hi Prem,

Please try the code below in the TableControlDrawCell event of the gridgroupingcontrol, to resolve this. In this event handler, draw a line on top of the column header cell.

private void gridGroupingControl1_TableControlDrawCell(object sender, GridTableControlDrawCellEventArgs e)
{
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(SystemColors.Control);
yPen.Width = 1.5f;
e.Inner.Graphics.DrawLine(yPen,e.Inner.Bounds.Location, new Point(e.Inner.Bounds.X + e.Inner.Bounds.Width, e.Inner.Bounds.Y));
}
}

Let me know if this helps.
Thanks,
Rajagopal


PR Prem August 11, 2006 03:17 PM UTC

Hi Rajagopal,
This did not work - I still see the white line which truncates the column header text when it wraps around. Also, the code you sent seems to draw a system color line - I guess I want to get rid of the existing white line.

Thanks,

>Hi Prem,

Please try the code below in the TableControlDrawCell event of the gridgroupingcontrol, to resolve this. In this event handler, draw a line on top of the column header cell.

private void gridGroupingControl1_TableControlDrawCell(object sender, GridTableControlDrawCellEventArgs e)
{
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(SystemColors.Control);
yPen.Width = 1.5f;
e.Inner.Graphics.DrawLine(yPen,e.Inner.Bounds.Location, new Point(e.Inner.Bounds.X + e.Inner.Bounds.Width, e.Inner.Bounds.Y));
}
}

Let me know if this helps.
Thanks,
Rajagopal


AD Administrator Syncfusion Team August 14, 2006 06:15 AM UTC

Hi Prem,

Please try setting the Buttons3D property to false.

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

Let me know if this helps.
Best Regards,
Haneef


PR Prem August 15, 2006 03:28 PM UTC

Hi Haneef,
That did not work - the text still gets truncated. Just curious if this is a known bug.

thanks,
Prem

>Hi Prem,

Please try setting the Buttons3D property to false.

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

Let me know if this helps.
Best Regards,
Haneef


AD Administrator Syncfusion Team August 16, 2006 12:29 PM UTC

Hi Prem,

Sorry for the inconvenience caused.

We tried to reproduce this in 4.2, but could not get this issue. Maybe I am not following the steps that you are doing. Attached sample working fine here. Can you post a sample showing this problem or tell us how to see it in the Browser sample/attached sample?

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/HeaderText_3d1d23d1.zip

Thanks for your patience.
Regards,
Haneef


PR Prem August 16, 2006 05:43 PM UTC

Hi Haneef,
First of all, I am using version 4.1.0.50.
In the sample you provided - after you run the application - reduce the width of the "ParentName" column - the column header text wraps around as expected but the top few pixels
of the letter "P" in the word "Parent" gets truncated.

Thanks,
Prem

>Hi Prem,

Sorry for the inconvenience caused.

We tried to reproduce this in 4.2, but could not get this issue. Maybe I am not following the steps that you are doing. Attached sample working fine here. Can you post a sample showing this problem or tell us how to see it in the Browser sample/attached sample?

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/HeaderText_3d1d23d1.zip

Thanks for your patience.
Regards,
Haneef


AD Administrator Syncfusion Team August 17, 2006 07:41 AM UTC

Hi Prem,

Please try the code below in the TableControlDrawCell event of the gridgroupingcontrol, to resolve this. In this event handler, draw the text in the column header cell.

private void gridGroupingControl1_TableControlDrawCell(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellEventArgs e)
{
if( e.Inner.Style.CellType == "ColumnHeaderCell")
{
//Handle the DrawCell event.
e.Inner.Cancel = true;

GridStyleInfo style = e.Inner.Style;
string Text = e.Inner.Style.Text;
style.Text = string.Empty;

//Draw the ColumnHeader Without Text
e.Inner.Renderer.Draw(e.Inner.Graphics,e.Inner.Bounds,e.Inner.RowIndex,e.Inner.ColIndex,style);

//for Formatting the Text in columnHeader
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.FormatFlags = StringFormatFlags.MeasureTrailingSpaces;
format.HotkeyPrefix = e.Inner.Style.HotkeyPrefix;
format.Trimming = e.Inner.Style.Trimming;

//for SortTriangle
Rectangle rect = e.Inner.Bounds;
rect.Width -= 10;

//Draw the Text in a ColumnHeader cell.
e.Inner.Graphics.DrawString(Text,e.Inner.Style.Font.GdipFont,new SolidBrush(e.Inner.Style.TextColor),rect,format);
}
}

Let me know if this helps.
Thanks,
Haneef


PR Prem August 20, 2006 03:42 PM UTC

Hi Haneef,
This seems to be working.
Thanks for all your help.

Prem

>Hi Prem,

Please try the code below in the TableControlDrawCell event of the gridgroupingcontrol, to resolve this. In this event handler, draw the text in the column header cell.

private void gridGroupingControl1_TableControlDrawCell(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellEventArgs e)
{
if( e.Inner.Style.CellType == "ColumnHeaderCell")
{
//Handle the DrawCell event.
e.Inner.Cancel = true;

GridStyleInfo style = e.Inner.Style;
string Text = e.Inner.Style.Text;
style.Text = string.Empty;

//Draw the ColumnHeader Without Text
e.Inner.Renderer.Draw(e.Inner.Graphics,e.Inner.Bounds,e.Inner.RowIndex,e.Inner.ColIndex,style);

//for Formatting the Text in columnHeader
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.FormatFlags = StringFormatFlags.MeasureTrailingSpaces;
format.HotkeyPrefix = e.Inner.Style.HotkeyPrefix;
format.Trimming = e.Inner.Style.Trimming;

//for SortTriangle
Rectangle rect = e.Inner.Bounds;
rect.Width -= 10;

//Draw the Text in a ColumnHeader cell.
e.Inner.Graphics.DrawString(Text,e.Inner.Style.Font.GdipFont,new SolidBrush(e.Inner.Style.TextColor),rect,format);
}
}

Let me know if this helps.
Thanks,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon