CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Resizing Part II

    Ok Folks, thanks for all your help on finding the event. Now the controls are not behaving as I want.

    I have a FlowLayoutPanel with properties set as follows:

    Locked = false
    Dock = none
    flowdirection = lefttoright

    In the Resize event I have:

    Code:
    flowLayoutPanel1.Left = this.Left + 20;
    When I drag the left side of the form to resize, the FLow Layout jumps varying distances from the left hand edge as opposed to staying constant as I'd expect.

    Is there any other properties that are of significance that I have missed?
    If you find my answers helpful, dont forget to rate me

  2. #2
    Join Date
    Oct 2004
    Location
    Rocket City
    Posts
    220

    Re: Resizing Part II

    The form.left is referenced to screen coordinates. However the panel.left is referenced to the form's client area.

    If you want the panel.left to stay constant, you do not need to change it in the form.resize. You probably do want to change panel.width to correspond to the client area change.

  3. #3
    Join Date
    Mar 2004
    Location
    33°11'18.10"N 96°45'20.28"W
    Posts
    1,808

    Re: Resizing Part II

    use pointtoclient

  4. #4
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: Resizing Part II

    I'll have a look at point to client. Zip's, I think you mis-understand.

    Yes I will want to change the width of the flowlayout as I increase the width of the form, but I also want the left side of the flow layout to stay a constant distance from the left edge of the form.

    When I drag the left edge of the form with no resize event, the gap just increases between the 2 edges. Draging the right hand edge will leave the left edges in tact.
    If you find my answers helpful, dont forget to rate me

  5. #5
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Red face Re: Resizing Part II

    Ok Folks, I didn't have any luck with pointtoclient.

    However I have had limited success setting the flowlayout's AutoSizeMode to GrowAndShrink and then resizeing the treeview control that's on the flowlayout as opposed to the flowlayout control directly. The controls resize ok if I'm expanding the form by Dragging the edge of the form. However, If I attempt to reduce the size of the form it will not reduce.

    I thought that it might be because the forms AutoSizeMode was set to GrowOnly, so I changed that to GrowAndShrink as well. However changing that I cant even resize to enlarge now. The form is effectively static ???
    Last edited by Bill Crawley; January 9th, 2007 at 07:33 AM. Reason: Change last comment
    If you find my answers helpful, dont forget to rate me

  6. #6
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: Resizing Part II

    Still have problems here if anyone has anymore ideas
    If you find my answers helpful, dont forget to rate me

  7. #7
    Join Date
    Apr 2005
    Posts
    576

    Re: Resizing Part II

    Add a Panel to the Form. Dock it to the left. Set Dock to Fill for the FlowLayoutPanel. Skip the resize events.

  8. #8
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: Resizing Part II

    Hi I've added a panel with a couple of text boxes and labels on in and set the Dock to Left. I then moved my flowlayout onto the form so that it wasn't on the Panel and set dock to fill on that.

    On the form itself I set AutoSizeMode to GrowAndShrink.

    However, I cannot resize the form. I basically want to resize controls proportionally as the user resizes the form manually either enlarging or reducing.
    If you find my answers helpful, dont forget to rate me

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