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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to resize control when screen resolution changed?

How to resize control when screen resolution changed?

Scheduled Pinned Locked Moved C / C++ / MFC
oophelptutorialquestion
2 Posts 2 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.
  • H Offline
    H Offline
    hanlei0000000009
    wrote on last edited by
    #1

    A single document project, view class inheritance from CFromView. In view from, have many controls, edit control, static control... When screen resolution changed or project runing from 16 by 10 screen to 4 by 3 screen, controls not printed right what printed right in 16 by 10 screen. I can use GetSystemMetrics(SM_CXFULLSCREEN) and GetSystemMetrics(SM_CYFULLSCREEN) to get screen resolution and then make controls size to fix to current screen,but controls are to many in from. I want to make all controls by simple way.

    L 1 Reply Last reply
    0
    • H hanlei0000000009

      A single document project, view class inheritance from CFromView. In view from, have many controls, edit control, static control... When screen resolution changed or project runing from 16 by 10 screen to 4 by 3 screen, controls not printed right what printed right in 16 by 10 screen. I can use GetSystemMetrics(SM_CXFULLSCREEN) and GetSystemMetrics(SM_CYFULLSCREEN) to get screen resolution and then make controls size to fix to current screen,but controls are to many in from. I want to make all controls by simple way.

      L Offline
      L Offline
      leonigah
      wrote on last edited by
      #2

      double xRatio = GetSystemMetrics(SM_CXSCREEN) / 800.00; double yRatio = GetSystemMetrics(SM_CYSCREEN) / 600.00; rect.left = long((rect.left/1.28)*xRatio); rect.top = long((rect.top/1.28)*yRatio); rect.bottom = long((rect.bottom/1.28)*yRatio); rect.right = long((rect.right/1.28)*xRatio);

      Nigah M Manzoor

      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