dcsimg
Results 1 to 4 of 4

Thread: Docking

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Posts
    669

    Docking

    Hi

    I have form whose window state is maximized. I have label , textbox & button . Then below i have reportviewer. How i set docking property
    so that reportviewer should always below label , textbox & button .

    Thanks

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,171

    Re: Docking

    If the "Dock" property doesn't do what you want try working with the "Anchor" property to get the placement you want.

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,754

    Re: Docking

    As wes4dbt suggests, Anchor is what you want. You would position the controls as you desire in the designer and probably set the Anchor as follows:

    Label: Top,Left
    TextBox: Top,Left,Right
    Button: Top,Right
    ReportViewer: Top,Bottom,Left,Right

    Follow the CodeBank link in my signature below and check out my thread on Dock & Anchor for an example.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,754

    Re: Docking

    Note that the Dock property makes controls push hard up against the edge of their parent so you generally would not have a data control docked to a form. You might have a container control, e.g. a Panel, docked to a form but data controls should generally have some space between them and the form edge. In the designer, snap lines will be used by default to allow you to position controls based on margin and padding values. You can use those snap lines to position/size your Label, TextBox, Button and ReportViewer and then, by setting the Anchor properties as I suggested, you'll find that the same spacing between controls will be maintained as the form grows and shrinks.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width