sfDataGrid.DrawCell += sfDataGrid_DrawCell;
void sfDataGrid_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e)
{
if (sfDataGrid.ShowRowHeader && e.RowIndex != 0)
{
if (e.ColumnIndex == 0)
{
e.Handled = true;
Rectangle rect = new Rectangle(e.Bounds.X + 3, e.Bounds.Y + 10, e.Bounds.Width - 3, e.Bounds.Height - 5);
e.Graphics.FillRectangle(new SolidBrush(sfDataGrid.Style.RowHeaderStyle.BackColor), new Rectangle(e.Bounds.X + 1, e.Bounds.Y + 1, e.Bounds.Width - 1, e.Bounds.Height - 1));
e.Graphics.DrawImage(new Bitmap(Image.FromFile(@"../../search.png")), e.Bounds.X + 30, e.Bounds.Y +3);
e.Graphics.DrawString(e.RowIndex.ToString(), new System.Drawing.Font("Calibri", 12), new System.Drawing.SolidBrush(System.Drawing.Color.Black), e.Bounds.X + 3, e.Bounds.Y+5);
e.Graphics.DrawLine(new Pen(ColorTranslator.FromHtml("#CCCCCC")), e.Bounds.Right, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom);
e.Graphics.DrawLine(new Pen(ColorTranslator.FromHtml("#CCCCCC")), e.Bounds.Left, e.Bounds.Bottom, e.Bounds.Right, e.Bounds.Bottom);
}
}
} |