Results 1 to 7 of 7

Thread: Making a form the right size when maximized

  1. #1

    Thread Starter
    Addicted Member Pantero's Avatar
    Join Date
    Jan 2009
    Posts
    169

    Making a form the right size when maximized

    Hi, how can i calibrate my form to be the same size in accordance to the screen size. So for instance if the original size of the form is 10cm by 10cm then when its maximized, how can i make the real size change automatically, because at the moment when i maximize the size of the buttons and labels etc. stay the same.

    Sorry for the bad explanation, its quite hard to explain.

    Thanks
    Im using visual basic 2008 express edition so any posts that include coding or stuff PLEASE refer to vb 2008.

    "A clever person solves problems, a wise person avoids them"

  2. #2
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: Making a form the right size when maximized

    I think you mean that you want to know how to get buttons and labels to expand to match the ratio size of a form when maximized, right?

    The answer is you can't. At least I'm pretty sure. You could do it manually but it would be a waste of time, having to set the sizes of all the objects is an unnecessary hastle.

    There may be some automatic way, someone else may know of it.

  3. #3

    Thread Starter
    Addicted Member Pantero's Avatar
    Join Date
    Jan 2009
    Posts
    169

    Re: Making a form the right size when maximized

    yes thats what i mean, i just couldn't explain properly, can anyone else provide a method?
    Im using visual basic 2008 express edition so any posts that include coding or stuff PLEASE refer to vb 2008.

    "A clever person solves problems, a wise person avoids them"

  4. #4
    Frenzied Member Bulldog's Avatar
    Join Date
    Jun 2005
    Location
    South UK
    Posts
    1,950

    Re: Making a form the right size when maximized

    This can be done, but as Vectris say, why?

    In the SizeChanged event, you would have to write code to relocate and resize the controls to the form size. This means that for each control, you need to determine its new Left/Right/Width/Height values.

    In practice, its 'normal' to use the anchor properties of controls like a ListView to anchor several edges so it expands/contracts with window size, but to anchor controls such like buttons to two edges, so they relocate (but do not change size). This should be done in one of the Resize events, if you want the user to see what is happening.


    • If my post helped you, please Rate it
    • If your problem is solved please also mark the thread resolved

    I use VS2015 (unless otherwise stated).
    _________________________________________________________________________________
    B.Sc(Hons), AUS.P, C.Eng, MIET, MIEEE, MBCS / MCSE+Sec, MCSA+Sec, MCP, A+, Net+, Sec+, MCIWD, CIWP, CIWA
    I wrote my very first program in 1979, using machine code on a mechanical Olivetti teletype connected to an 8-bit, 78 instruction, 1MHz, Motorola 6800 multi-user system with 2k of memory. Using Windows, I dont think my situation has improved.

  5. #5

    Thread Starter
    Addicted Member Pantero's Avatar
    Join Date
    Jan 2009
    Posts
    169

    Re: Making a form the right size when maximized

    because i am doing a project and if i can show that i am capable of doing this then i would get more marks.
    Also i have a background picture which when maximized starts to repeat itself.
    Im using visual basic 2008 express edition so any posts that include coding or stuff PLEASE refer to vb 2008.

    "A clever person solves problems, a wise person avoids them"

  6. #6
    Frenzied Member Bulldog's Avatar
    Join Date
    Jun 2005
    Location
    South UK
    Posts
    1,950

    Re: Making a form the right size when maximized

    To prevent the background image repeating set Me.BackgroundImageLayout to Stretch or Zoom.

    So as I mentioned, you can either write some code in the resize event to scale/locate everything or use the anchor properties of the controls to achieve the same result.


    • If my post helped you, please Rate it
    • If your problem is solved please also mark the thread resolved

    I use VS2015 (unless otherwise stated).
    _________________________________________________________________________________
    B.Sc(Hons), AUS.P, C.Eng, MIET, MIEEE, MBCS / MCSE+Sec, MCSA+Sec, MCP, A+, Net+, Sec+, MCIWD, CIWP, CIWA
    I wrote my very first program in 1979, using machine code on a mechanical Olivetti teletype connected to an 8-bit, 78 instruction, 1MHz, Motorola 6800 multi-user system with 2k of memory. Using Windows, I dont think my situation has improved.

  7. #7

    Thread Starter
    Addicted Member Pantero's Avatar
    Join Date
    Jan 2009
    Posts
    169

    Re: Making a form the right size when maximized

    yes, but if i stretch or zoom, will it still be the same size when it is minimized? I think it will be cropped
    Im using visual basic 2008 express edition so any posts that include coding or stuff PLEASE refer to vb 2008.

    "A clever person solves problems, a wise person avoids them"

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