Results 1 to 4 of 4

Thread: Changing the resolution at run-time.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Nottingham, England
    Posts
    197
    Could someone please tell me how to change the screen resolution at run-time. I am writing an application, and I would prefer it if it could automatically put the screen into 800x600 mode. My forms look better in 800x600! (I drew everything in 800x600 mode.)

    Alternatively, I have experimented with sizing routines. These just read the resolution and redraw everything to look right at any setting. I get the current screen setting, and redraw all controls as follows:

    Private Sub Form_Load()
    Dim X as control

    Me.Width = Me.Width * (CurrentPixelsX/800)
    Me.Height = Me.Height * (CurrentPixelsY/600)

    For Each X In Me.Controls
    X.Width = X.Width * (CurrentPixelsX/800)
    X.Height = X.Height * (CurrentPixelsY/600)
    X.Left = Me.Left * (CurrentPixelsX/800)
    X.Top = Me.Top * (CurrentPixelsY/600)
    Next X

    (CurrentPixelsX and CurrentPixelY are variables that hold the current screen resolution. I can get these values without difficulty.) This works fine - just need to watch out for timers and things which can't be moved/resized at run-time. Easy to find with an extra line:

    If Typeof X Is Timer = False Then
    {Resize commands}
    EndIf

    So why doesn't my new method work? It doesn't re-size pictures that have been used on command buttons! The resized buttons look really odd!

    So, if anyone could tell me either:

    How to change the screen resolution at run-time
    Or
    How to make command button pictures resize with the button

    I'd be most grateful. (I'd prefer the first option!)

    Thanks very much,

    Steve.

    P.S. How do I include actual VB code in these threads?
    Sent by: Steve Barker
    E-mail: [email protected]

    P.S. I KNOW 1 is not a prime!
    See this thread: http://forums.vb-world.net/showthread.php?threadid=26485

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    code brackets [ code ] and to end it [ /code ] just without spaces.
    Compare your code to this, maybe that will help.
    http://www.vb-world.net/graphics/tip67.html

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Nottingham, England
    Posts
    197
    Thanks for the link SteveCRM!

    I don't understand your code brackets though!

    Cheers,

    Steve.
    Sent by: Steve Barker
    E-mail: [email protected]

    P.S. I KNOW 1 is not a prime!
    See this thread: http://forums.vb-world.net/showthread.php?threadid=26485

  4. #4
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    In posts, you should put code in code brackets.

    Code:
    some code
    =
    [ code ]
    some code
    [ /code ]
    (remove the spaces)

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