Results 1 to 11 of 11

Thread: [RESOLVED] Weird issue with controls position at high DPI

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Resolved [RESOLVED] Weird issue with controls position at high DPI

    I found that the minimun and maximun limits for the Left position of controls (not tested Top, but it is probably the same) that can be set varies with DPI.

    At 200% (192 DPI) the limits are from -114688 to 114681 Twips
    At 250% (240 DPI) the limits are from -98304 to 98298 Twips
    From 255% (245 DPI) to 300% (288 DPI) the limits are from -81920 to 81915 Twips
    From 305% (293 DPI) to 375% (360 DPI) the limits are from -65536 to 65532 Twips
    From 380% (365 DPI) to 500% (480 DPI) the limits are from -49152 to 49149 Twips

    How to understand these numbers?

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Weird issue with controls position at high DPI

    It's probably a Win32 limitation, such as a range from -16384 to 16383 pixels.

    If you look up WM_MOVE you will see that only 16 bits are used for X and Y positions. That should allow twice as large a range, but perhaps there is another restriction such as limits in your video driver. Or maybe the lower limits are documented somewhere?

    Sounds like a question for Raymond Chen to me.

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Weird issue with controls position at high DPI

    Actually, the values are all the same relative to VB's internal DPI: 16383 pixels on the maximum side, you can double check the minimum side. Based on who posted and the results shown, sounds like your test app, or IDE, is at least system-DPI aware.

    For VB, internally it uses a rounded down TwipsPerPixel calculated as: 1440 \ DPI
    So @ 192 DPI, that formula returns: 7.5 and rounded down is 7
    Now take your max twips value (at 192 DPI is 114681) and divide by internal DPI: 114681 / 7 = 16383

    If you do that for all your positive values at relative internal VB twips per pixels, you will see that the maximum position did not change at all

    For any others that want to play along, your IDE must be at least system DPI aware to play in the IDE. Else you can create a compiled test application that is system-DPI aware.

    P.S. No, my name is not Raymond Chen
    Last edited by LaVolpe; Aug 13th, 2020 at 08:10 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: Weird issue with controls position at high DPI

    Yes, I have the IDE manifested for DPI aware por monitor V2.

    The test program was:

    Code:
    Private Sub Command1_Click()
        Label1.Left = -185000
        Label2.Left = 185000
        Caption = Label1.Left & " " & Label2.Left
    End Sub
    Thank you, it makes sense what you say.

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] Weird issue with controls position at high DPI

    You're welcome.

    Just food for thought. What happens when DPI gets to 1450? That's about 3x your tested maximum.

    Does VB just completely fall apart? Its internal twips per pixel should be zero at that point. Or does VB default to a minimum or go to single instead?

    Just another nail in the coffin for VB unfortunately.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: [RESOLVED] Weird issue with controls position at high DPI

    Quote Originally Posted by LaVolpe View Post
    Just another nail in the coffin for VB unfortunately.
    Just curious: Have you picked a horse to put your money on yet?

    I've looked at many alternatives over the last few years but nothing seems to come close. For all of its warts .Net probably has the best toolchain for VB-style development. B4J feels the next closest to me. I'm still not satisfied.

    Xojo is (was) similar to VB, but I don't expect it to handle High DPI well without a lot of fiddling. And its documentation is too lacking last time I looked to work out the fiddling.

    I'm not trying to hijack this thread into a long "What next?" discussion. Just curious.

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [RESOLVED] Weird issue with controls position at high DPI

    Quote Originally Posted by LaVolpe View Post
    You're welcome.

    Just food for thought. What happens when DPI gets to 1450? That's about 3x your tested maximum.

    Does VB just completely fall apart? Its internal twips per pixel should be zero at that point. Or does VB default to a minimum or go to single instead?

    Just another nail in the coffin for VB unfortunately.
    Yes, now I can only set the scale to 500% (480 DPI) in a 4K TV.
    I know that there are already 8K TVs. Windows might allow 1000% in the future (perhaps).
    But it is unlikely that the TVs/monitors will go beyond that (at least in the near future) because the eye cannot see the pixels, even on large TVs.
    On very large TVs you need to sit appart, so there is a limit on resolutions that has a practical effect, because even with 20/20 vision, if you are too close you are able to see the pixels but not the whole picture, and if you are too far you see the whole picture but not the pixels.
    There are many articles about the subject on internet.

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,996

    Re: [RESOLVED] Weird issue with controls position at high DPI

    Quote Originally Posted by dilettante View Post
    Just curious: Have you picked a horse to put your money on yet?

    I've looked at many alternatives over the last few years but nothing seems to come close. For all of its warts .Net probably has the best toolchain for VB-style development. B4J feels the next closest to me. I'm still not satisfied.

    Xojo is (was) similar to VB, but I don't expect it to handle High DPI well without a lot of fiddling. And its documentation is too lacking last time I looked to work out the fiddling.
    There is nothing. Only Olaf's promise.

    Quote Originally Posted by dilettante View Post
    I'm not trying to hijack this thread into a long "What next?" discussion. Just curious.
    No problem.

  9. #9
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] Weird issue with controls position at high DPI

    Quote Originally Posted by dilettante View Post
    Just curious: Have you picked a horse to put your money on yet?
    VB6 consultant maybe -- semi-joking.

    I'm really getting up there in age. Thinking about retiring in a couple years when youngest finishes college. I've even fantasized about bookin' down to South America at that ripe old age to die from an excess of alcohol and younger women. Already have a bad ticker & can't think of a better way to go
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  10. #10
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: [RESOLVED] Weird issue with controls position at high DPI

    If you're serious, do it before you develop something else that slows your roll. Arthritis, lymphedema, diminished vision or hearing, and bad knees are just the short list.

    I was in the hospital for a week when I had severe abdominal cramping I don't think they ever diagnosed. That went away by itself but they kept me for congestive heart failure. The latter is probably related to the nasty lymphedema I had developed months earlier. Nothing like both lower legs swelling up, developing strange big blisters, and then those turn into weeping sores that don't heal. Thankfully I'm long past that and have it under control, but its a battle I have to keep fighting. Low sodium diet, monitoring my daily fluid intake, and compression stockings are just the bigger parts of that. I'm on 7 prescriptions now where a year ago I was on none. At least i don't need to use the oxygen concentrator at night any more much less the portable tank. And no more home care for dressing changes, which was a pain.

    Stuff that seems funny or unheard of when younger can suddenly jump up to bite you later in life.

    Sucks to get old.

  11. #11
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] Weird issue with controls position at high DPI

    Dang dilettante, think you're in worse shape the me -- look at us old-timers comparing scars.

    4 years ago, my heart gave out. I died in the hospital for several minutes and have some brain damage, but not too serious; mostly long term memory got burned which affects my vocabulary and some motor skills a tiny bit. Guess those brain cells aren't coming back. Docs placed some hardware in my chest, so thinking severe exertion probably won't do me in the first time -- yep, get yer mind in the gutter.

    In any case, I need a paycheck until daughter is out of school. In another year or so, I'll be re-learning Spanish.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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