Results 1 to 8 of 8
  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Mixed resolutions (VB 6.0 / W98)

    I noticed that when I tried my VB application on a computer with a slightly lower screen resolution all of my windows appeard shifted down toward the lower right corner of the screen.

    Is there a recommended way to sense the monitor's resolution and adjust code to keep the VB windows centered on the screen?

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mixed resolutions (VB 6.0 / W98)

    I put together an example of an API call in Access of detecting and setting a user's resolution based on an example from The Access Web. This should work fine in VB.

    See attachment (Access 97 format)...

    HTH <img src=/S/salute.gif border=0 alt=salute width=15 height=20>
    Attached Files Attached Files

  3. #3
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Mixed resolutions (VB 6.0 / W98)

    Hi Mark,

    It looks rather complicated, but I'll give it a try.

    Thanks for the help.

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Mixed resolutions (VB 6.0 / W98)

    Chuck,

    There is a Screen object (not available in VBA) that has width an height properties. These properties depend upon the screen resolution in use, The following code should center the active form on the screen, regardless of resolution :<pre>Private Sub Form_Load()
    Me.Left = (Screen.Width - Me.Width) / 2
    Me.Top = (Screen.Height - Me.Height) / 2
    End Sub</pre>


    Andrew C

  5. #5
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Mixed resolutions (VB 6.0 / W98)

    Thanks Andrew,

    Looks like it works -- at least on my machine. I'll try it on another with different resolution.

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mixed resolutions (VB 6.0 / W98)

    You also should scale the controls.

    Examples of how to do this are discussed in a number of places, including Ken Getz's Access Develpers Handbook.

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    New York
    Posts
    214
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mixed resolutions (VB 6.0 / W98)

    I have a similar question about cross platform development between Windows Word and Mac Word. Forms and their controls developed in Word Windows all look terrible when ported to the Mac.

    Is there a way to design around this?

  8. #8
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mixed resolutions (VB 6.0 / W98)

    I've never tried using screen resolution dependent stuff on Macs, so I do not know whether the code works there too. Some of such code depends on API calls, or may be Windoze dependent.

    The only PC/Mac stuff I've done did not depend of what the Userform looked like. The clients were not fussy. I guess that for such a concern, I'd have to buy a Mac and then conditionalize the Userform for each system.

    Otherwise, I would try to develop userforms on PCs that look good at all resolutions and leave a bit of extra space between controls and make the controls a little bit bigger, so text/controls do not get squeezed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •