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. Windows Forms
  4. splitContainer splitterdistance set before size in designer

splitContainer splitterdistance set before size in designer

Scheduled Pinned Locked Moved Windows Forms
helpgraphicsdockerquestionlearning
2 Posts 1 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.
  • K Offline
    K Offline
    Keith Barrow
    wrote on last edited by
    #1

    I use VS2008. I have a [horizontally] splitContainer, in the designer its width is set to 924px, The splitter distance to 462px and both panels have their minimum width set to 370. So far so good, when I built I got an error, along the lines of "The spliter distance must be set between the minium width of Panel1 and the container width - minimum width of container 2" (not those exact words). In my book that means the splitter distance of 462 must be between 370 and (924 - 370 = 554) which, unless arithmatic or the fundamental nature of maths has changed since I was a boy, it is. The problem is that in the Designer.cs class this code

    this.splitContainerMain.Size = new System.Drawing.Size(924, 496);

    comes after

    this.splitContainerMain.Panel1.Controls.Add(this.groupBoxUnrecognised);
    this.splitContainerMain.Panel1MinSize = 370;
    //
    // splitContainerMain.Panel2
    //
    this.splitContainerMain.Panel2.Controls.Add(this.splitContainerDone);
    this.splitContainerMain.Panel2MinSize = 370;

    and splitContainerMain uses a default width of 150px, breaking the calculation. Is there any way to fix this problem permanently?

    CCC solved so far: 2 (including a Hard One!) 37!?!! - Randall, Clerks

    K 1 Reply Last reply
    0
    • K Keith Barrow

      I use VS2008. I have a [horizontally] splitContainer, in the designer its width is set to 924px, The splitter distance to 462px and both panels have their minimum width set to 370. So far so good, when I built I got an error, along the lines of "The spliter distance must be set between the minium width of Panel1 and the container width - minimum width of container 2" (not those exact words). In my book that means the splitter distance of 462 must be between 370 and (924 - 370 = 554) which, unless arithmatic or the fundamental nature of maths has changed since I was a boy, it is. The problem is that in the Designer.cs class this code

      this.splitContainerMain.Size = new System.Drawing.Size(924, 496);

      comes after

      this.splitContainerMain.Panel1.Controls.Add(this.groupBoxUnrecognised);
      this.splitContainerMain.Panel1MinSize = 370;
      //
      // splitContainerMain.Panel2
      //
      this.splitContainerMain.Panel2.Controls.Add(this.splitContainerDone);
      this.splitContainerMain.Panel2MinSize = 370;

      and splitContainerMain uses a default width of 150px, breaking the calculation. Is there any way to fix this problem permanently?

      CCC solved so far: 2 (including a Hard One!) 37!?!! - Randall, Clerks

      K Offline
      K Offline
      Keith Barrow
      wrote on last edited by
      #2

      OK this is a bit schitzo, answering my own question, but I've found the magic google search term and go a word around here from here http://social.msdn.microsoft.com/forums/en-US/winformsdesigner/thread/ee6abc76-f35a-41a4-a1ff-5be942ae3425/[^] In the parent form, hook into the Load event and set the MinSize property there, not in the designer. The obvious option (moving the code in the designer.cs file) is repeatedly overwritten if the form is re-worked (in my case just setting the tab order did this) and is not viable long term. Pretty bad design work from Microsoft IMO!

      CCC solved so far: 2 (including a Hard One!) 37!?!! - Randall, Clerks

      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