CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2011
    Posts
    19

    disgusted with panels

    panels are nice but working with them is a pain when im changing their visibility modes.can anyone suggest a better option that will work like a panel but i can work with better ease?

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: disgusted with panels

    Changin the visibilty of the panels is pretty simple, not sure what problem you may be having but it is hard to find something eaiser than visible=true or visible=false
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: disgusted with panels

    there is not a general rule, and your sentence is a bit too general:
    working with them is a pain when im changing their visibility modes
    do you mean at runtime you do not get the right visual things you would?
    do you mean you have too much stuff and you lose correct z-order?

    In any case,if matter is at runtime, you could try using a FlowLayoutPanel (with autoscroll = true) as the general container inside a form (or a tab of a TabControl if you need more than one) Every thing you put in a flowLayoutPanel will arrange itself while invisible elemenst apparently disappears.
    Better, however, keep together things that should appear or disapper as one thing in a ....panel or groupbox container.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  4. #4
    Join Date
    Nov 2011
    Posts
    19

    Re: disgusted with panels

    sorry for being so naive, i meant when i try to put a panel on top of another panel,the panel at the back becomes invisible because of overlapping.my intention is to put a set of controls like textbox,buttons etc on one container,then have another set on another container.then when i push a button, container1 will become visible.same thing will happen after i push another button,but this time container1 will become hidden and container2 will come to sight.
    all i can think of is this
    Code:
    panel1.visible=false;
    panle2.visible=true;
    or vice versa.but its not worthy.i am thinking of another type of container but couldnt manage to find any.am i clear now?

  5. #5
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: disgusted with panels

    That would work fine the thing you need to be aware of is that if you try to put one panel over another in the IDE there is a good chance that the panel will go inside the existing panel and your method will fail.

    The way I normally handle this is to place one of the panels where I actually want it, then place the others at different locations so as to be able to see and work with them at design time even if it means making the form very large in the ide. At runtime I will set the form size to what i actually want it to be if needed and set all the panel locations=the panel I placed where I wanted them. Then it is just a matter of toggling the visible property on the various panels as needed.
    Always use [code][/code] tags when posting code.

  6. #6
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: disgusted with panels

    try flowlayoutpanel
    or
    TabControl
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured