如何使用OnPaint args将图标添加到C#中的TreeView控件 [英] How to add icons to TreeView control in c# using OnPaint args

查看:246
本文介绍了如何使用OnPaint args将图标添加到C#中的TreeView控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用ImageList控件的情况下在c#中向TreeView控件添加图标?我认为您需要tp调用OnPaint事件args,但不知道如何执行.

解决方案

您必须编写OwnerDraw控件代码.除非您没有真正认真的理由,否则请避免这种情况,因为如果您想以一种很好的方式做到这一点,可能会导致非常复杂的情况.

看看这个例子.

DrawNode事件

How to add icons to TreeView control in c# WITHOUT the ImageList control? I think you need tp call the OnPaint event args but no idea how to do it.

解决方案

Yo have to code OwnerDraw control. Unless you have not really serious reasons, avoid this, as this can turn out into very complicated scenarios, if you want to do it in a good way.

Have a look on this example.

DrawNode event

这篇关于如何使用OnPaint args将图标添加到C#中的TreeView控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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