By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,101 Members | 1,340 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,101 IT Pros & Developers. It's quick & easy.

DataGridView not raising CellPainting event

P: 26
Hello all,

I am using DataGridView in my user control and its CellPainting event in C#. I have some merged cells in my control.
When I drag & drop my control in other application, the LAST ROW of the DataGridView is not getting painted. Rest of the rows and columns in those rows are getting painted properly.
Actually problem here is DataGridView is not raising CellPainting event for that last row. The rest of the things like DataSet & DataTable are there getting updated correctly, but last row is not getting painted.
Even when i debugged the app, the break point did not hit for
e.RowIndex == 16.

Can anyone please help me with this....

Thanks in advance
Jan 1 '09 #1
Share this Question
Share on Google+
4 Replies

Expert 5K+
P: 5,000
It'd probably help more if you posted your code.
Jan 1 '09 #2

Expert 100+
P: 229
When you say you have some "merged cells", I presume it means you are handling the CellPainting event and then drawing them yourself to look merged? Note that since these cells are internally not merged, DataGridView will only raise the event if it thinks it should draw a specific cell, not a range of cells.
Jan 2 '09 #3

Expert 5K+
P: 7,872
and you are sure there are 17 rows in your object?
Jan 2 '09 #4

P: 26
Ya there are 17 rows in object.

The problem is not yet solved, but now i removed the DataGridView and painting my control in paint event only.

Thanks for all your help

Jan 12 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.