المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How can I subscribe to "DataGridView.CellDisplayRectangleUpdatedAfterDataGridViewScroll"-events?



C# Programming
01-13-2010, 11:01 AM
I am working with a DataGridView and I am subscribing to DataGridView.Scroll events. As soon as I get a scroll-event, I query the new cell display area:

private void dataGridView1_Scroll(Object sender, ScrollEventArgs e)
{
Rectangle r1 = dataGridView1.GetCellDisplayRectangle(0, -1, true);
Console.WriteLine("New cell position after scrolling: " + r1.X + ", " + r1.Y);
}

However, it seems the CellDisplayRectangle isn't updated by the time I get the scroll-event. What event should I subscribe to instead to get the correct CellDisplayRectangle after the DataGridView was scrolled?