Results 1 to 10 of 10

Thread: Form control to readjust size/position

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Location
    sydney
    Posts
    265

    Form control to readjust size/position

    Hi,
    is there a way to automatically adjust the form controls sizes and positions if screen resolutions changes ?

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: Form control to readjust size/position

    To some extent... that's what the Anchor and Docking properties are for... but it also depends on what you mean by "position" ... TableLayoutPanel or a FlowLayoutPanel might be what you want in those cases... so some combination of those 4 items should be able to accomplish a considerable amount resizing and rearranging based on screen size - actually, it more dependent on the form size, which should be impacted by screen resolution.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Form control to readjust size/position

    Changing control sizes if the parent size changes is one thing but why would you do it if the resolution changes? If I change my resolution it is because I want either more or less on my screen. If my applications then decide that they're going to change their size then that defeats the purpose of changing the resolution in the first place. Other than in exceptional circumstances, what you're suggesting is the complete opposite of what the user would want and just plain bad.

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: Form control to readjust size/position

    That's true... I didn't really think about it like that.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Location
    sydney
    Posts
    265

    Re: Form control to readjust size/position

    when i run my application on a pc with lower resolution screen (and Bigger size in some cases ), controls get overlapped and hidden. I read a blog which suggests resizing and relocating all child control in line with parent resize ratio. would there be a better approach ?

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Form control to readjust size/position

    Quote Originally Posted by wiss.dev View Post
    when i run my application on a pc with lower resolution screen (and Bigger size in some cases ), controls get overlapped and hidden. I read a blog which suggests resizing and relocating all child control in line with parent resize ratio. would there be a better approach ?
    As I said, resizing and repositioning controls based on their parent's size is quite reasonable but the size of the parent should be independent of the resolution of the screen. Follow the CodeBank link in my signature and check out my thread on Anchor & Dock and see if that sorts you out. If not then please be specific about the issue, including screenshots.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Form control to readjust size/position

    It might also be that the issue is DPI and not resolution. You can try changing the AutoScaleMode of the form from Font to Dpi and see if that fixes the issue. This often seems to be an issue when running an application on a laptop that was developed on a desktop machine.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Location
    sydney
    Posts
    265

    Re: Form control to readjust size/position

    I think the problem is in the width of my form (1369 * 707),
    I do my dev on a laptop (1600 * 900), my test screen is 1280 * 1024 and because windows state is set to maximise the form width outsizes the screen and trims off some controls

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: Form control to readjust size/position

    You need to design your form to support the smallest size that you want to support and then use Dock, Anchor, etc, to scale up from there. If your form is bigger than the screen then that's an obvious issue and a developer mistake.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Location
    sydney
    Posts
    265

    Re: Form control to readjust size/position

    I agree.. Thanks for your help

Tags for this Thread

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