Hi Arulpriya,
Setting the this.gridControl.HScrollPixel = true; fixed my issue. Thanks for the sample link.
I have another question -
I have a very long column say 15000px long. Is there a way to have the header for this column fixed? So that even no matter what position the horizontal scroll bar is we can still see the header text.
Thanks in advance.
Jeevan
//Event triggering
this.gridControl1.HorizontalScroll += GridControl1_HorizontalScroll;
//Event Cudtomization
private void GridControl1_HorizontalScroll(object sender, ScrollEventArgs e)
{
this.gridControl1.InvalidateRange(GridRangeInfo.Row(0));
}
//Event triggering
this.gridControl1.DrawCellDisplayText += new GridDrawCellDisplayTextEventHandler(gridControl1_DrawCellDisplayText);
//Event Customization
void gridControl1_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e)
{
Rectangle rectangle = this.gridControl1.RangeInfoToRectangle(GridRangeInfo.Cell(e.RowIndex, e.ColIndex));
Rectangle nextRectangle = this.gridControl1.RangeInfoToRectangle(GridRangeInfo.Cell(e.RowIndex, e.ColIndex + 1));
Rectangle tableControlRectangle = this.gridControl1.ClientRectangle;
Rectangle textRect = e.TextRectangle;
if (e.RowIndex == 0 &&
rectangle.X + rectangle.Width >= nextRectangle.X)
{
e.Graphics.DrawString(e.DisplayText, e.Style.GdipFont, new SolidBrush(e.Style.TextColor), (int)(rectangle.X), textRect.Y);
e.Cancel = true;
}
}
|
Hi ArulPriya,
Thanks a lot. The solution helped me.
Regards,
Jeevan