9/20/2023 0 Comments Winform treeview![]() ![]() In the mean time, the workaround is to use the TreeView’s SelectedNode property instead. I googled up this problem and I found that this bug was reported on Connect, and it will be fixed in the next version. Apparently, during the expand, if there are more child nodes that fit on the screen, the parent node scrolls to the top, but the cursor stays in the same place where the double click occurred. Notice where the cursor is – that’s the node that was passed in the event handler. And that helped me realize that the e.Node is actually the node that is currently under the mouse cursor!ĭouble clicking on Fonts makes the following happen: I placed a MessageBox.Show(e.Node.Text) in the NodeMouseDoubleClick handler. I made a small WinForms application with just a TreeView, and I filled it with the contents of my C:\Windows directory. ![]() I noticed that it was not the same node all the time – it was different. Since the sub-child nodes count was 0, the event handled the (incorrect) node. To my surprise, I discovered today that by double clicking on a collapsed parent node, the e.Node parameter was not the node I actually double clicked on, but one of the child nodes. Most of the time when we need something to happen when a child node is double clicked, but not the parent, we write something similar to: void NodeMouseDoubleClick( object sender, TreeNodeMouseClickEventArgs e) Usually, double clicking on a collapsed tree node (which obviously has child nodes) will expand it. In the list of templates, choose Windows Forms Application. In the New Projectdialog box, do the following: In the categories, choose either Visual Basicor Visual C. Here’s a strange bug I’ve encountered today in a WinForms application. To create the form containing a ListView and TreeView control On the Filemenu, point to New, and then click Project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |