Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Problem when adding to a SplitContainer

Problem when adding to a SplitContainer

Scheduled Pinned Locked Moved C#
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mew_lobo
    wrote on last edited by
    #1

    Hi, I'm trying to create a MDI window which has a SplitContainer, on the left SplitterPanel a treeview and when a node is double clicked a Form should open in the right SplitterPanel. I'm trying to make the Form a child of the MDI Window and also display it within the right SplitterPanel. The problem is that, when I double click the TreeView node, the Form which is added to the right Splitter Panel is not added as a child of the MDI and it also does not have focus. I can move the Form window and access its controls, but it does not retain focus. This is the code I used to add the Form ( done within the Constructor) // g_mdiform is a instance of the MDI window // g_mdiform.WorkingPanel returns the right SplitterPanel this.MdiParent = g_mdiform; g_mdiform.WorkingPanel.Controls.Add(this); I tried the following code within the Mdi Window class as a test. Form frm = new Form(); frm.SetBounds(100, 20, 100, 100); frm.MdiParent = this; splMDIPane.Panel2.Controls.Add(frm); frm.Show(); The above problem still exists.... If anyone knows how I can resolve this, please let me know... Thanks Mahesh

    A 1 Reply Last reply
    0
    • M mew_lobo

      Hi, I'm trying to create a MDI window which has a SplitContainer, on the left SplitterPanel a treeview and when a node is double clicked a Form should open in the right SplitterPanel. I'm trying to make the Form a child of the MDI Window and also display it within the right SplitterPanel. The problem is that, when I double click the TreeView node, the Form which is added to the right Splitter Panel is not added as a child of the MDI and it also does not have focus. I can move the Form window and access its controls, but it does not retain focus. This is the code I used to add the Form ( done within the Constructor) // g_mdiform is a instance of the MDI window // g_mdiform.WorkingPanel returns the right SplitterPanel this.MdiParent = g_mdiform; g_mdiform.WorkingPanel.Controls.Add(this); I tried the following code within the Mdi Window class as a test. Form frm = new Form(); frm.SetBounds(100, 20, 100, 100); frm.MdiParent = this; splMDIPane.Panel2.Controls.Add(frm); frm.Show(); The above problem still exists.... If anyone knows how I can resolve this, please let me know... Thanks Mahesh

      A Offline
      A Offline
      Andrew Lygin
      wrote on last edited by
      #2

      Hi, Mahesh. If you want to create a classic MDI application then you shouldn't use SplitterPanel in your main form. You just need to follow next steps: 1. Set MainForm.IsMdiContainer = true. 2. Add a TreeView to the MainForm and set treeView.Dock = Left. 3. Add a Splitter to the MainForm and set splitter.Dock = Left. 4. When you need to create MDI child use this:

      ChildForm child = new ChildForm();
      child.MdiParent = this;
      child.Show();

      M 1 Reply Last reply
      0
      • A Andrew Lygin

        Hi, Mahesh. If you want to create a classic MDI application then you shouldn't use SplitterPanel in your main form. You just need to follow next steps: 1. Set MainForm.IsMdiContainer = true. 2. Add a TreeView to the MainForm and set treeView.Dock = Left. 3. Add a Splitter to the MainForm and set splitter.Dock = Left. 4. When you need to create MDI child use this:

        ChildForm child = new ChildForm();
        child.MdiParent = this;
        child.Show();

        M Offline
        M Offline
        mew_lobo
        wrote on last edited by
        #3

        Hi Andrew, Thanks :-) I was trying to create a Tree navigator that could be hidden or moved out of the way if required... :-D I'm still new to C# and doing a project for my degree. I was trying to get a Navigator which is Dockable and Floatable. I was trying to use a SplitContainer so that the Navigator could be hidden when not required. I found a third party library (from a code project article) called Magic Library, which provides a great docking manager... It seems to provide the functionality that I require. I'm trying to use that for the Tree Navigator. thanks again for ur help :-) Mahesh

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups