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. Adding dynamicly controls to a Panel

Adding dynamicly controls to a Panel

Scheduled Pinned Locked Moved C#
helptutorialquestion
3 Posts 3 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
    seq
    wrote on last edited by
    #1

    Hello, I have the following problem, In a window form I have a panel (with autosroll enabled) and inside this panel I would like to add dynamicly other panels. I have a variable that holds the number of panels inside the main Panel. So whenever I add a new panel,its location is calculated by (number_of_panels+space_between_two_panels)*panel_height The code works fine.. until I scroll down the mainpanel to the bottom, then when I add a new panel inside it there is a huge gap between the last panel and the newly added one. Any one can tell me why? and how to solve it ?(I dont want to scroll the main panel all the way up just to add a new panel). Help appreciated, Pawel

    S R 2 Replies Last reply
    0
    • S seq

      Hello, I have the following problem, In a window form I have a panel (with autosroll enabled) and inside this panel I would like to add dynamicly other panels. I have a variable that holds the number of panels inside the main Panel. So whenever I add a new panel,its location is calculated by (number_of_panels+space_between_two_panels)*panel_height The code works fine.. until I scroll down the mainpanel to the bottom, then when I add a new panel inside it there is a huge gap between the last panel and the newly added one. Any one can tell me why? and how to solve it ?(I dont want to scroll the main panel all the way up just to add a new panel). Help appreciated, Pawel

      S Offline
      S Offline
      Stefan Troschuetz
      wrote on last edited by
      #2

      I think you have to somehow consider the value returned by the AutoScrollPosition property in your calculation.


      "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

      www.troschuetz.de

      1 Reply Last reply
      0
      • S seq

        Hello, I have the following problem, In a window form I have a panel (with autosroll enabled) and inside this panel I would like to add dynamicly other panels. I have a variable that holds the number of panels inside the main Panel. So whenever I add a new panel,its location is calculated by (number_of_panels+space_between_two_panels)*panel_height The code works fine.. until I scroll down the mainpanel to the bottom, then when I add a new panel inside it there is a huge gap between the last panel and the newly added one. Any one can tell me why? and how to solve it ?(I dont want to scroll the main panel all the way up just to add a new panel). Help appreciated, Pawel

        R Offline
        R Offline
        Robert Rohde
        wrote on last edited by
        #3

        Hi, what your are doing sound principally correct and the fact that you have scrolled shouldn't matter. I assume there is some little mistake in your implementation (probably you are using a wrong property at some place). You probably have to post some code. Instead of calculating all positions yourself you could also with panel.Dock = DockStyle.Top to the container panel. This way the framework should handle the correct positioning. Robert

        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