Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sir

I have one DataGridview. It contains one DataGridview Image column. I created two labels it's inside the cell, by using CellPainting event. The cell look like this:

Label 1
Image
Label 2


My Grid contains no of rows when I am move the scroll bar of the datagridview or any cell content click event fired every time CellPainting event is fired.

So that Image column getting vibrating and it become very bad look.

To avoid this what can I do?

Is there any way please help me.



Thank you
Posted
Updated 17-Aug-11 1:50am
v3
Comments
LittleYellowBird 17-Aug-11 7:08am    
Just to let you know not all programmers are male. :)
[no name] 17-Aug-11 7:17am    
:-)
BobJanova 17-Aug-11 7:52am    
I'd still call you Sir.
kranthi.oru 17-Aug-11 7:17am    
who are u?
kranthi.oru 17-Aug-11 7:35am    
Alison are u male of female.

1 solution

This is what the CellPainting event does – it tells you when a cell is being painted! A cell is painted whenever it's scrolled into view, and this event will be called then.

I suspect you want to do this in DataBindingComplete or RowAdded.
 
Share this answer
 
Comments
kranthi.oru 17-Aug-11 8:37am    
i think u don't understand
BobJanova 17-Aug-11 11:25am    
Perhaps so, but I am -sure- that you don't. CellPainting events are called when cells are scrolled into view. You don't seem to understand that this is not the right event to hook for something which you don't want to happen every time a cell is scrolled into view.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900