Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / February 2006

Tip: Looking for answers? Try searching our database.

How to Dock subclassed TreeView in Panel?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
deko - 28 Feb 2006 00:58 GMT
How do I get two subclassed TreeViews to share a panel with a splitter?

I have 2 derived TreeView controls:

  internal class TreeConfiguration : TreeView

  internal class TreeProject : TreeView

How do I get them docked in a panel?

In the constructor of my Form I have this:

public FormSettings()
{
  InitializeComponent();

  TreeNode[] allNodes = ProjectHelper.getAllNodes();
  TreeConfiguration tc = new TreeConfiguration(allNodes);
  TreeProject tp = new TreeProject(allNodes);
  panelTree.Controls.Add(this.TreeConfiguration);
  panelTree.Controls.Add(splitterTree);
  panelTree.Controls.Add(this.TreeProject);
}

Compile Error:
...'FormSettings' does not contain a definition for 'TreeConfiguration' ...

Do I need to mess with the Designer code to add these TreeViews to my form?

Thanks in advance.
deko - 28 Feb 2006 01:40 GMT
This seems to work, but the TreeNode array is added twice to
TreeConfiguration, and TreeProject is blank.  strange...

TreeNode[] allNodes = ProjectHelper.getAllNodes();
TreeConfiguration tc = new TreeConfiguration(allNodes);
TreeProject tp = new TreeProject(allNodes);
panelTree.Controls.Add(tc);
panelTree.Controls.Add(tp);
tc.Dock = DockStyle.Left;
tp.Dock = DockStyle.Fill;
deko - 28 Feb 2006 01:52 GMT
> This seems to work, but the TreeNode array is added twice to
> TreeConfiguration, and TreeProject is blank.  strange...
[quoted text clipped - 6 lines]
> tc.Dock = DockStyle.Left;
> tp.Dock = DockStyle.Fill;

It APPEARS as if the nodes are added twice to TreeConfiguration, but they
are in fact added to TreeProject.  It's just that tree in TreeProject is
being drawn OVER TreeConfiguration.  For some reason the splitter does not
seem to be working right.... ???
deko - 28 Feb 2006 02:03 GMT
Even if I do this:

  TreeNode[] allNodes = ProjectHelper.getAllNodes();
  TreeConfiguration tc = new TreeConfiguration(allNodes);
  TreeProject tp = new TreeProject(allNodes);
  panelTree.Controls.Add(tc);
  panelTree.Controls.Add(tp);
  tc.Dock = DockStyle.Left;
  tp.Dock = DockStyle.Right; <<=== * CHANGE *

the TreeProject nodes are STILL on top of the TreeConfiguration treeview.
I'm starting to think that you can't have two TreeView controls share the
same container.  If this is the case, then I can't use a splitter.

Other suggestions?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.