locked
fix controls in panel RRS feed

  • Question

  • hi , i have a panel in which i have some controls like label dgv and textbox and picturebox

    in my application in certain situation the panel re-sizes and and all the control lose there default location which is then be used is their any when panel get bigger or smaller the controls stays where they are....

    please help as soon as possible im in hurry

    thanks 

    Sunday, January 22, 2012 7:49 PM

Answers

  • All panels/controls physical locations are governed by their panels X/Y location & their own docks/anchors of all panels/controls...

    As long as the controls have top left anchors and the X/Y location of the panels doesn't change they will stay in the same spot, size changing to stretch left/right with those anchors set for both....

    If you don't want things to move up then you could always un-dock the panel to fill & set it at the same location it's where you want it & keep it there alone, if you don't want any of it to move just don't set your anchors but top left & they will stay there at that side of the form not moving up down, left or right...but if they don't size bigger(wider) then you don't have more space for typing, etc....if you make any wider side by side that means others will be moved likely out of the way(pushed right) unless their set not to move which may have controls appearing over one another which is usually un-desirable....

    So i'm not sure your specific goal(a screenshot of close to how you want it, and what it's doing now/or a short video & explanation may help to give you a good solution to the problem your having with the control/panel sizing/placement....

    • Proposed as answer by Mark Liu-lxf Tuesday, January 24, 2012 2:28 AM
    • Marked as answer by Mark Liu-lxf Monday, January 30, 2012 9:30 AM
    Monday, January 23, 2012 4:14 PM

All replies

  • It's hard to make sense of what you're asking, but I'll give it a stab.

    I'm assuming that when you say "certain situations", you mean when the form is re-sized? If so, look at the anchor and/or docking settings in the properties (or in code).

    Sunday, January 22, 2012 8:13 PM
  • like i have menustrip in my form dock to top and the entire form is fill with panel1 and now the problem that is

    when i print using printform component and make visibility  of menustrip false and then panel1 got the place of menustrip and the albel at top edge of panel change it location and and go little upward and i don't want the label to change it posistion

    please help

    hurry!

    and thanks 

    Sunday, January 22, 2012 8:23 PM
  • You'll find that people here don't cotton to being told "hurry" ...

    It sounds like you have the panel also docked, so yea - if you make another docked component not visible, then the the docking property kicks in and fills the rest of it.

    Try to set the docking property off for the panel, then adjust the size and dock it to the bottom (not fill). It's hard to visualize exactly what you have.

    Good luck with it.



    EDIT

    No - that's not right. Turn the panel's docking property off and set the anchor for left, right, and bottom (not top).

    Sunday, January 22, 2012 8:27 PM
  • yeah thanks

    but i need to extend the height of my form and panel while running 

    thanks

    Monday, January 23, 2012 3:35 PM
  • chohan try to move the label off the panel then setting the location from the properties window, this way something not docked on the panel will be viewed above it, if you have layering problems you can right click & move the label forward or the panel back in the z-order....

    you can't drag it though because it will be over the panel & anything dragged over a panel snaps into it, but it has a different effect if you modify location from the properties menu...or if you move the panel out of the way you can drag it into place first then move the panel in over/around it....

    Remember, if you have layering issues, the label is below the panel for example you can re-order controls by right clicking on them, and clicking move forward/back in the z-order...

    this will prevent the label from moving when the panel is resized...

    • Edited by Maya Key Monday, January 23, 2012 3:51 PM
    Monday, January 23, 2012 3:49 PM
  • no no no you not understanding

     

    i have a form and have 7 panels in it and  the  5,6,7 panel are in the middle and dock to fill

    now the i used to slide panels 5, 6, 7 through button and extends the height of the form with the button

    no when i want that if panel re-sizes the controls in doesn't move or change its location and non of the controls in the panel are docked

    thanks allot 

    Monday, January 23, 2012 4:05 PM
  • All panels/controls physical locations are governed by their panels X/Y location & their own docks/anchors of all panels/controls...

    As long as the controls have top left anchors and the X/Y location of the panels doesn't change they will stay in the same spot, size changing to stretch left/right with those anchors set for both....

    If you don't want things to move up then you could always un-dock the panel to fill & set it at the same location it's where you want it & keep it there alone, if you don't want any of it to move just don't set your anchors but top left & they will stay there at that side of the form not moving up down, left or right...but if they don't size bigger(wider) then you don't have more space for typing, etc....if you make any wider side by side that means others will be moved likely out of the way(pushed right) unless their set not to move which may have controls appearing over one another which is usually un-desirable....

    So i'm not sure your specific goal(a screenshot of close to how you want it, and what it's doing now/or a short video & explanation may help to give you a good solution to the problem your having with the control/panel sizing/placement....

    • Proposed as answer by Mark Liu-lxf Tuesday, January 24, 2012 2:28 AM
    • Marked as answer by Mark Liu-lxf Monday, January 30, 2012 9:30 AM
    Monday, January 23, 2012 4:14 PM
  • hi,

    use anchor property of the controls.


    By Country Snail
    Monday, January 23, 2012 6:46 PM