Results 1 to 9 of 9

Thread: [RESOLVED] Form Size According to Controls in it...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Resolved [RESOLVED] Form Size According to Controls in it...

    When my Program runs

    its looks all bad because the form is out of shape..

    please look at the attachment.. controls finish somewhere else and still shows a lot of space after that

    How do i make sure that all forms are sized properly according to controls inside it??

    Attached Images Attached Images  

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Form Size According to Controls in it...

    See This from shakti5385
    Please mark you thread resolved using the Thread Tools as shown

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Re: Form Size According to Controls in it...

    excellent coding

    but that is not my problem

    see that extra blank at the right hand side.. i need to remove that..

    as i have kept the resize = false in the form so it wont resize so that code will not work which is in that link

    i need to fix that size.. in design mode it looks ok.. there is no gap after controls on the right hand side

  4. #4
    Addicted Member
    Join Date
    Mar 2002
    Location
    St. Louis MO
    Posts
    129

    Re: Form Size According to Controls in it...

    compute where the right edge of a control would be (control.left * control.width)
    If this is the righmost one you have found so far, remember it for later.
    Loop through this for all controls on your form.

    When you are done looping, set the form.width to the righmost value you found when you did your looping.

  5. #5
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Form Size According to Controls in it...

    This is an odd question. If you don't want your form to be resizing then disable it. Set the borderstyle to 1 or Fixed Single at design time. It seems that you dont want to mess with the controls inside, all you wanted was to keep the form as is during design and runtime.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Re: Form Size According to Controls in it...

    see.. i think i did not get my point right

    look at the pic.. u see that extra space on right hand side.. it comes during runtime.. but not at design time..

    how do i remove that extra width which is showing on the right hand side...

  7. #7
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Form Size According to Controls in it...

    I see you don't get my point either. Have you tried my suggestion?

    Set your borderstyle to Fixed Single. Because there's no way it'll change the size unless the windowstate is maximized at design time.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Posts
    139

    Re: Form Size According to Controls in it...

    yep

    working.. thanks zynder

    repped and thread resolved

  9. #9
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: [RESOLVED] Form Size According to Controls in it...

    No probs mate!

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