如何每次停止datagridview单元绘画事件. [英] how to stop datagridview cell painting event each time.

查看:374
本文介绍了如何每次停止datagridview单元绘画事件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生

我有一个DataGridview.它包含一个DataGridview Image列.我通过使用CellPainting事件在单元格内创建了两个标签.该单元格如下所示:

标签1
图片
标签2


当我移动datagridview的滚动条或每次触发CellPainting事件时触发的任何单元格内容单击事件时,我的网格均不包含任何行.

这样,图像"列会振动,并且看起来非常糟糕.

为避免这种情况该怎么办?

有什么办法可以帮助我.



谢谢

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

推荐答案

这是CellPainting事件的作用–它会告诉您何时绘制单元格!每当滚动到视图中时,便会绘制一个单元格,然后将调用此事件.

我怀疑您想在DataBindingComplete或RowAdded中执行此操作.
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.


这篇关于如何每次停止datagridview单元绘画事件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆