添加后如何从树视图中删除图像
使用 Visual Studio 2010 和 C#,我有一个树视图,并向每个节点添加了图像。回想起来,我现在想要删除与 3 个主根节点的子节点关联的图像。如何从 3 个主根节点的子节点中删除图像,但将图像保留在 3 个根节点上?
我尝试打开节点的属性,并将所有子节点的 ImageIndex 和 SelectedImageIndex 更改为“none”,当我按“确定”时,它仍然显示每个子节点的默认图像。
谢谢
Using visual studios 2010 and c# i have a treeview and i added images to each of the nodes. In retrospect i now want to remove the images that are associated with the children of the 3 main root nodes. How do i remove the images from the children of my 3 main root nodes but keep the images on the 3 root nodes?
I have tried opening the properties for the nodes and changed the ImageIndex and SelectedImageIndex to "none" for all of the children nodes and when i press ok, it still shows the default image for each child node.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定,但我相信您可以通过 TreeView 中的每个控件在 [TreeView].Controls... 中执行 foreach... 在那里您可以搜索 [control].GetType() == typeof( [type_of_the_image]),并执行一些逻辑以获取主要图像。
除此之外,您可以通过 jQuery 删除,执行类似于我上面所说的操作。如果您对这些想法感兴趣,我可以帮助您开发。
I'm not sure of it, but I believe that you can pass through every control inside the TreeView doing a foreach in [TreeView].Controls... In there you can search for [control].GetType() == typeof([type_of_the_image]), and do some logic to get just the main ones.
Besides that, you can remove by jQuery, doing something close to what I said above. If these ideas are something that interests you, I can help with the development.