Hi,
I've a project compiled for .net 3.5. In the project there is a form with a DataGridView. In CellPainting I'am adding row numbers in row header:
private void dataGridView1_CellPainting(object sender, System.Windows.Forms.DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex == -1)
{
e.PaintBackground(e.ClipBounds, true);
using (StringFormat st = new StringFormat())
{
st.Alignment = StringAlignment.Center;
st.LineAlignment = StringAlignment.Center;
e.Graphics.DrawString(Convert.ToString(e.FormattedValue), e.CellStyle.Font, Brushes.Black, e.CellBounds, st);
e.Handled = true;
}
}
}
When I test it on win8 where .net 3.5 is enabled, everything works ok. If there is .net3.5 disabled and only 4.5 is enabled, this is working pretty slow. Row numbers in row headers flicker and other forms are not refreshed well. When row headers are hidden, Form works ok, and the application is quite fast. Is there a way to prevent the slowness of the application when headers are visible? Any idea why this code isn't working?(beside incompatibility of .net versions)