How to remove the space occupied by a control when it is hidden in c# windows form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Prathap
    New Member
    • Nov 2011
    • 37

    How to remove the space occupied by a control when it is hidden in c# windows form?

    Could someone please tell me how to remove the space occupied by a control when it is hidden.
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    What do you mean, exactly... like, you want to hide a control and have everything else shift up to fill in?

    I think you're going to have to give us more information about what you're doing... like, are your controls directly on the form or are they in a panel. Is the panel a FlowLayoutPanel or just a regular panel?

    Anyway, unless it's a FlowLayoutPanel and it automatically does this, I think you'll have to handle this manually. If a FlowLayoutPanel doesn't do this, you can always remove your control from the panel when you hide it, then re-add it in the correct place when you show it.

    Play around, and if you need some help feel free to ask but give us more information about what you're trying to do.

    Comment

    • Prathap
      New Member
      • Nov 2011
      • 37

      #3
      Suppose, i placed 3 buttons directly in a form(button1 button2 button3)and i changed the visibility of button2 as hidden.When we run the form a blank space will be there between button1 and button2.I dont know how to remove that blank space.Please help

      Comment

      • GaryTexmo
        Recognized Expert Top Contributor
        • Jul 2009
        • 1501

        #4
        Please see the second part of my post above.

        Comment

        Working...