树视图加减图标变大
如何在 C# .net 的树视图中使加号图标更大,而不禁用视觉样式。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何在 C# .net 的树视图中使加号图标更大,而不禁用视觉样式。
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
我认为你对此没有任何控制权。 您唯一能做的就是重写 DrawNode 事件并自己绘制节点。
首先,您需要将 DrawMode 更改为 OwnerDrawAll。 看一下相关的msdn页面,它包含令人惊讶的详细信息: http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.drawnode.aspx
I don't think you have any control about it. The only thing you can do is override the DrawNode event and paint the nodes yourself.
First you need to change the DrawMode to OwnerDrawAll. Take a look at the relevant msdn page, it contains surprisingly much detail: http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.drawnode.aspx
这有点晚了......但刚刚遇到了这个,并发现(偶然)有一种(间接)方法来控制TreeView(在WinForms中)上加/减号的大小。
您基本上必须添加一个图像列表,并且 TreeView 的加号/减号将随着图像的大小而变化。 要在设计器中看到这一点,请执行以下操作:
我不认为列表中必须有图像,尽管我还没有尝试过这种方式。 希望这对某人有帮助。
This is a bit late... but just ran into this, and discovered (by accident) that there is an (indirect) way to control the size of the plus/minus signs on the TreeView (in WinForms).
You basically have to add an image list, and the TreeView plus/minus signs will change with the size of the images. To see this in the designer, do the following:
I do not believe that you have to have images in the list, though I have not tried it that way. Hope this helps someone.
比默认的 10px 左右大吗? 我认为遵循上面的答案,但因为我在尝试确定如何恢复原始大小时遇到了这个:
事实证明,如果设置缩进属性,您可以进行一些控制 - 任何小于 10 px 的内容都会开始缩小 +/- 图标。 我有一个树视图,其缩进量设置为 5,我发现将其恢复到 15(甚至 10)可以恢复图标大小。
我希望这可以帮助其他人在该领域寻找解决方案。
Bigger than the default 10px or so? I think follow the answer above, but because I came across this while trying to determine how to restore the original size:
Turns out you have some control if you set the indent property - anything less than 10 px starts to shrink the +/- icons. I had a treeview that was being set with an indent of 5, and I found that by restoring it to 15 (or even 10) restored the icon size.
I hope that helps someone else looking for a solution in that area.