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. TableLayoutPanel

TableLayoutPanel

Scheduled Pinned Locked Moved C#
questionhelp
2 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.
  • S Offline
    S Offline
    Silvyster
    wrote on last edited by
    #1

    Hello, I have a problem on the table layout panel control. I wanted to create a program that on run time I could set the table layout panel's number of rows and columns. My Problem is that the spaces of each boxes on the table are not evenly distributed. How do I make it evenly distributed?

    U 1 Reply Last reply
    0
    • S Silvyster

      Hello, I have a problem on the table layout panel control. I wanted to create a program that on run time I could set the table layout panel's number of rows and columns. My Problem is that the spaces of each boxes on the table are not evenly distributed. How do I make it evenly distributed?

      U Offline
      U Offline
      usermans
      wrote on last edited by
      #2

      This code worked fine for columns, it can also be slightly modifed to fit for rows:

      tableLayoutPanel1.ColumnStyles.Clear();
      int numOfColumns = 4;
      tableLayoutPanel1.ColumnCount = numOfColumns;
      for (int i = 0; i < numOfColumns ; i++ )
      {
      ColumnStyle cStyle = new ColumnStyle();
      cStyle.SizeType = SizeType.Percent;
      cStyle.Width = 100 / numOfColumns;
      tableLayoutPanel1.ColumnStyles.Add(cStyle);
      }

      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