treeview hosting a combobox ?

  • Thread starter Thread starter Jeff MacDuff
  • Start date Start date
J

Jeff MacDuff

I am trying to create a treeview in .net which isnt a problem, however
I want the treeview to be able to contain combo boxes instead of just
strings.

Windows XP already does this in the printer dialog like this:
http://www.madhaxor.com/misc/sample.jpg

How can I do this in C# / .Net ?

Thanks!
Jeff
 
You can start by doing someting like:
private void treeView1_AfterSelect(object sender,
System.Windows.Forms.TreeViewEventArgs e)

{

TreeView t=(TreeView)sender;

theCombo.Top=e.Node.Bounds.Top+t.Top;

theCombo.Left=e.Node.Bounds.Right+10+t.Left;

}

Where "theCombo" is a combo you have dropped on the form. You could of
course create this in code without dropping it on.

You would also want to add code to copy the data to/from the combo, and to
edit the label of the combo after the change.

The combo needs to be hidden when the wrong node-type is selected (or no
node is selected) - all needed info should be in the "e"-object above, or in
the TreeView itself.

Regards,
Harald Bjorøy
www.ulriken-consulting.no
 
Back
Top