根据条件在Row标题中绘制图像 [英] Paint a image in Row header based on condition

查看:57
本文介绍了根据条件在Row标题中绘制图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我试图根据某些条件在行标题文本中显示图像。这是我的要求



首先我选择一个excel文件,它显示在datagridview中。然后,当我单击提交按钮时,这些excel值将逐行插入。



如果成功插入第一行,我想显示一个图像@那个行标题,

如果失败那么另一个图像等等on。





我怎样才能实现这一点..请帮助我。顺便说一下它的窗口形式:)

Hi,

I am trying to show an image in row header text based on certain condition.Here's my requirement

First i select an excel file, which is displayed in datagridview. Then when i click submit button these excel values are inserted row by row.

If first row is inserted successfully, i want to show an image @ that row header,
if it fails then another image and so on.


How can i achieve this.. Pls help me. By the way its windows form :)

推荐答案

我试着订阅CellPainting [ ^ ]事件。在其处理程序方法中,您可以执行所需的任何条件检查。并在其参数 [ ^ ]你得到一个图形 [ ^ ]绘制适合您需要的对象。 />


我还没有尝试过是否适合标题单元格。
I'd try subscribing to the CellPainting[^] event. Within its handler method, you can perform any conditional checks you want. And within its arguments[^] you get a Graphics[^] object to draw whatever fits your need.

I haven't tried whether that works for heading cells, though.


这篇关于根据条件在Row标题中绘制图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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