积极答复者
datagridview根据表格内容转换图片

问题
答案
-
运行的时候不能更改单元格类型。你可以在一个从DataGridViewColumn派生出来的列(这样你可以自定义DataGridViewCell的类型)里放一个user control
user control里面放一个textbox一个picturebox,但是同一时间内只有一个可见,根据单元格的值决定显示哪一个。
Visual C++ MVP -
Hi,
根据我的搜索结果,没有发现相关的三方产品解决这个问题。
这边是一个相似的解决方案,就是如何在一个单元格里面显示文字和图片,你可以参考他提供的代码。
对于新的问题,对于MSDN规则,你可以重新开帖。
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
- 已标记为答案 yzjjhk 2018年1月24日 15:03
全部回复
-
运行的时候不能更改单元格类型。你可以在一个从DataGridViewColumn派生出来的列(这样你可以自定义DataGridViewCell的类型)里放一个user control
user control里面放一个textbox一个picturebox,但是同一时间内只有一个可见,根据单元格的值决定显示哪一个。
Visual C++ MVP -
运行的时候不能更改单元格类型。你可以在一个从DataGridViewColumn派生出来的列(这样你可以自定义DataGridViewCell的类型)里放一个user control
user control里面放一个textbox一个picturebox,但是同一时间内只有一个可见,根据单元格的值决定显示哪一个。
Visual C++ MVP恩,明白了
以前试过直接把datagridviewtextboxcells强转成datagridviewibuttoncells成功了,以为都可以这么转
您的方法其实就等于重写控件了。
有没有第三方控件能直接实现这个功能的呢?
-
Hi,
根据我的搜索结果,没有发现相关的三方产品解决这个问题。
这边是一个相似的解决方案,就是如何在一个单元格里面显示文字和图片,你可以参考他提供的代码。
对于新的问题,对于MSDN规则,你可以重新开帖。
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
- 已标记为答案 yzjjhk 2018年1月24日 15:03