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. DesignTimeSupport for TableLayoutPanel with dynamic added controls in each cell

DesignTimeSupport for TableLayoutPanel with dynamic added controls in each cell

Scheduled Pinned Locked Moved Windows Forms
csshelpquestion
3 Posts 2 Posters 2 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.
  • A Offline
    A Offline
    akamper
    wrote on last edited by
    #1

    Hi I hope you can help me I'm trying to create my own control to support the following: It should be a table/grid (row X cells) where each cell can contain a textfield/label/button/checkbox etc. So I created my own Control extending the TableLayoutPanel and added a textfield for each cell in the constructor of my control. When I add my own TableControl in my hosted Designer to my form then I'm only able to access the properties of the TableLayoutPanel. But I cannot select each Textfield in the cells in the TableLayoutPanel seperately to change those properties. If I only add the TableLayoutPanel to my form and consequently add all the textfields to the cells, then I'm able to select those textfields seperately. How can I implement those behaviour, when the tableLayoutPanel must not get created wit empty cells (every cell must contain a control and the control must be able to get selected to change the properties). If there is a better choice than the TableLayoutPanel for my planned behaviour. I hope you can understand my intention. Thanks in advance

    H 1 Reply Last reply
    0
    • A akamper

      Hi I hope you can help me I'm trying to create my own control to support the following: It should be a table/grid (row X cells) where each cell can contain a textfield/label/button/checkbox etc. So I created my own Control extending the TableLayoutPanel and added a textfield for each cell in the constructor of my control. When I add my own TableControl in my hosted Designer to my form then I'm only able to access the properties of the TableLayoutPanel. But I cannot select each Textfield in the cells in the TableLayoutPanel seperately to change those properties. If I only add the TableLayoutPanel to my form and consequently add all the textfields to the cells, then I'm able to select those textfields seperately. How can I implement those behaviour, when the tableLayoutPanel must not get created wit empty cells (every cell must contain a control and the control must be able to get selected to change the properties). If there is a better choice than the TableLayoutPanel for my planned behaviour. I hope you can understand my intention. Thanks in advance

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      I believe that to achieve the results you want you will have to implement a custom designer for your new control. This article may give you a start Designing Nested Controls[^]. At the very least it should give you some terms to search on (ParentControlDesigner for example). If that does not lead you to a solution then you could 'surface' the properties of the internal controls (see snippet below). This will not allow them to be selected but will at least allow their properties to be set.

          class MyPanel : TableLayoutPanel
          {
              public string NameText
              {
                  get
                  {
                      return myNameTextBox.Text;
                  }
      
                  set
                  {
                      myNameTextBox.Text = value;
                  }
              }
          }
      

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      A 1 Reply Last reply
      0
      • H Henry Minute

        I believe that to achieve the results you want you will have to implement a custom designer for your new control. This article may give you a start Designing Nested Controls[^]. At the very least it should give you some terms to search on (ParentControlDesigner for example). If that does not lead you to a solution then you could 'surface' the properties of the internal controls (see snippet below). This will not allow them to be selected but will at least allow their properties to be set.

            class MyPanel : TableLayoutPanel
            {
                public string NameText
                {
                    get
                    {
                        return myNameTextBox.Text;
                    }
        
                    set
                    {
                        myNameTextBox.Text = value;
                    }
                }
            }
        

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

        A Offline
        A Offline
        akamper
        wrote on last edited by
        #3

        Thanks. I'll have a closer look at it

        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