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. horizontal splitter

horizontal splitter

Scheduled Pinned Locked Moved C#
questionvisual-studio
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.
  • B Offline
    B Offline
    balkang
    wrote on last edited by
    #1

    Hi I am still using VS 2003, and I want to use horizontal splitter in my window form. How can i do that? thanks..

    N 1 Reply Last reply
    0
    • B balkang

      Hi I am still using VS 2003, and I want to use horizontal splitter in my window form. How can i do that? thanks..

      N Offline
      N Offline
      Nader Elshehabi
      wrote on last edited by
      #2

      Hello I don't use VS2003 yet i think the splitter control should work fine for you -not the splitcontainer control-. This code is copied from MSDN documentaion with some modifications to make the splitter horizontal as you asked:

      private void CreateMySplitControls()
      {
      // Create TreeView, ListView, and Splitter controls.
      TreeView treeView1 = new TreeView();
      ListView listView1 = new ListView();
      Splitter splitter1 = new Splitter();

      // Set the TreeView control to dock to the left side of the form.
      treeView1.Dock = DockStyle.Bottom;
      // Set the Splitter to dock to the left side of the TreeView control.
      splitter1.Dock = DockStyle.Bottom;
      // Set the minimum size the ListView control can be sized to.
      splitter1.MinExtra = 100;
      // Set the minimum size the TreeView control can be sized to.
      splitter1.MinSize = 75;
      // Set the ListView control to fill the remaining space on the form.
      listView1.Dock = DockStyle.Fill;
      // Add a TreeView and a ListView item to identify the controls on the form.
      treeView1.Nodes.Add("TreeView Node");
      listView1.Items.Add("ListView Item");
      
      // Add the controls in reverse order to the form to ensure proper location.
      this.Controls.AddRange(new Control\[\]{listView1, splitter1, treeView1});
      

      }

      So, you add a splitter, and dock the other control to bottom -or top-, then dock your splitter like it, and the other control that will be in the other pane should be docked as fill or as the opposite direction. Regards:rose:

      B 1 Reply Last reply
      0
      • N Nader Elshehabi

        Hello I don't use VS2003 yet i think the splitter control should work fine for you -not the splitcontainer control-. This code is copied from MSDN documentaion with some modifications to make the splitter horizontal as you asked:

        private void CreateMySplitControls()
        {
        // Create TreeView, ListView, and Splitter controls.
        TreeView treeView1 = new TreeView();
        ListView listView1 = new ListView();
        Splitter splitter1 = new Splitter();

        // Set the TreeView control to dock to the left side of the form.
        treeView1.Dock = DockStyle.Bottom;
        // Set the Splitter to dock to the left side of the TreeView control.
        splitter1.Dock = DockStyle.Bottom;
        // Set the minimum size the ListView control can be sized to.
        splitter1.MinExtra = 100;
        // Set the minimum size the TreeView control can be sized to.
        splitter1.MinSize = 75;
        // Set the ListView control to fill the remaining space on the form.
        listView1.Dock = DockStyle.Fill;
        // Add a TreeView and a ListView item to identify the controls on the form.
        treeView1.Nodes.Add("TreeView Node");
        listView1.Items.Add("ListView Item");
        
        // Add the controls in reverse order to the form to ensure proper location.
        this.Controls.AddRange(new Control\[\]{listView1, splitter1, treeView1});
        

        }

        So, you add a splitter, and dock the other control to bottom -or top-, then dock your splitter like it, and the other control that will be in the other pane should be docked as fill or as the opposite direction. Regards:rose:

        B Offline
        B Offline
        balkang
        wrote on last edited by
        #3

        It works.. thanks.

        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