Resizing A Treeview

eric13

Active member
Joined
May 25, 2006
Messages
30
Programming Experience
3-5
Can a treeview be resized at run-time by a user.

I want the user to be able to change the width of the treeview so they can increase viewing area as they expand treenodes.
 
Do you want the user to resize the whole form, or just the TreeView control within the form? If it's the whole form then you simply set the Anchor property of the TreeView appropriately so it remains a fixed distance from each edge as the form is resized. If you want them to be able to resize the TreeView within a static form then it's up to you to do it. You can provide a couple of NumericUpdown controls that they can adjust and you set the Height and Width of the TreeView accordingly. That's kludgier for the user but easier for you. The alternative is to implement drag and drop, which is smoother and more familiar for the user but more difficult for you. It's a good skill to learn though. The steps in drag and drop are the same no amtter what you're dragging. I'd suggest looking up the DoDragDrop method on MSDN for more info.
 
Back
Top