Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Dialog size does not change when DPI settings change

Dialog size does not change when DPI settings change

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _T No name
    wrote on last edited by
    #1

    Hi, I have made a custom dialog have done some custom Drawing on it. it is derived from CDialog. when i change DPI settings on my system dialog size does not change accordingly.. I need it to be changed as i have set my font size according to DPI and font size changes.. plz help P.S. :- Not even dialog size i have some other custom controls also like button its size also does not change in my application Thanks

    K 1 Reply Last reply
    0
    • _ _T No name

      Hi, I have made a custom dialog have done some custom Drawing on it. it is derived from CDialog. when i change DPI settings on my system dialog size does not change accordingly.. I need it to be changed as i have set my font size according to DPI and font size changes.. plz help P.S. :- Not even dialog size i have some other custom controls also like button its size also does not change in my application Thanks

      K Offline
      K Offline
      KingsGambit
      wrote on last edited by
      #2

      May be you can handle WM_SETTINGCHANGE or WM_DISPLAYCHANGE message and see if you get the notification when the system settings is changed.

      _ 1 Reply Last reply
      0
      • K KingsGambit

        May be you can handle WM_SETTINGCHANGE or WM_DISPLAYCHANGE message and see if you get the notification when the system settings is changed.

        _ Offline
        _ Offline
        _T No name
        wrote on last edited by
        #3

        that message is coming... but do i need to handle this seperately.. i mean shouldnt MFC change window size automatically ???

        CPalliniC 1 Reply Last reply
        0
        • _ _T No name

          that message is coming... but do i need to handle this seperately.. i mean shouldnt MFC change window size automatically ???

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          _T("No name") wrote:

          i mean shouldnt MFC change window size automatically ???

          Well, if it doesn't (and looks like it doesn't) then you have to do it, I guess it isn't such a daunting task. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          _ 1 Reply Last reply
          0
          • CPalliniC CPallini

            _T("No name") wrote:

            i mean shouldnt MFC change window size automatically ???

            Well, if it doesn't (and looks like it doesn't) then you have to do it, I guess it isn't such a daunting task. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            _ Offline
            _ Offline
            _T No name
            wrote on last edited by
            #5

            i am not getting any idea how to incorporate DPI in setting my dialog's width.. can u help me out....

            CPalliniC 1 Reply Last reply
            0
            • _ _T No name

              i am not getting any idea how to incorporate DPI in setting my dialog's width.. can u help me out....

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              If you wish to update your dialog size then, one simple way may be:

              • define a default (pixel) size for a default DPI setting (for instance 800x600 pixels for 96x96 dpi).
              • on receiving the 'system dpi changed' notification, change the size according to new dpi settings, for instance, 120x120 dpi would require: (800*120/96) x (600*120/96) pixels = 1000x750 pixels.

              You may obtain system dpi settings with the following code

              HDC hdc = GetDC(NULL);
              int dpix = GetDeviceCaps(hdc, LOGPIXELSX);
              int dpiy = GetDeviceCaps(hdc, LOGPIXELSY);
              ReleaseDC(NULL, hdc);

              :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              In testa che avete, signor di Ceprano?

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups