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 restrict user to reduce size of dialog box

How to restrict user to reduce size of dialog box

Scheduled Pinned Locked Moved C / C++ / MFC
csstutorialquestionlearning
3 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.
  • B Offline
    B Offline
    BlrBoy
    wrote on last edited by
    #1

    Hello all, I want to restrict user not to reduce the size of dialog within limits. My dialog box is created in resource editor and class is derived from CDialog. I made the Border property "resizable" and it allows the user to resize the dialog. I want to restrict the user not to reduce the size than certain limit. I write the code in OnSize handler as below void CMyDlg::OnSize(UINT nType, int cx, int cy) { if (cx < 650) cx = 650; if (cy < 270) cy = 270; CDialog::OnSize(nType, cx, cy); // resize all controls present in the dialog box } But the dialog still can be reduced less than width 650 and height 270. I tried to put "return" if the cx is < 650 and cy < 270. but user can still reduce the size. Can any one suggest how to restict the user? Thanks for your time Ravi

    S D 2 Replies Last reply
    0
    • B BlrBoy

      Hello all, I want to restrict user not to reduce the size of dialog within limits. My dialog box is created in resource editor and class is derived from CDialog. I made the Border property "resizable" and it allows the user to resize the dialog. I want to restrict the user not to reduce the size than certain limit. I write the code in OnSize handler as below void CMyDlg::OnSize(UINT nType, int cx, int cy) { if (cx < 650) cx = 650; if (cy < 270) cy = 270; CDialog::OnSize(nType, cx, cy); // resize all controls present in the dialog box } But the dialog still can be reduced less than width 650 and height 270. I tried to put "return" if the cx is < 650 and cy < 270. but user can still reduce the size. Can any one suggest how to restict the user? Thanks for your time Ravi

      S Offline
      S Offline
      Sarath C
      wrote on last edited by
      #2

      Try OnSizing[^]

      -Sarath. The more you can dream the more you can do - Michael Korda"

      My blog - Sharing My Thoughts, An Article - Understanding Statepattern

      1 Reply Last reply
      0
      • B BlrBoy

        Hello all, I want to restrict user not to reduce the size of dialog within limits. My dialog box is created in resource editor and class is derived from CDialog. I made the Border property "resizable" and it allows the user to resize the dialog. I want to restrict the user not to reduce the size than certain limit. I write the code in OnSize handler as below void CMyDlg::OnSize(UINT nType, int cx, int cy) { if (cx < 650) cx = 650; if (cy < 270) cy = 270; CDialog::OnSize(nType, cx, cy); // resize all controls present in the dialog box } But the dialog still can be reduced less than width 650 and height 270. I tried to put "return" if the cx is < 650 and cy < 270. but user can still reduce the size. Can any one suggest how to restict the user? Thanks for your time Ravi

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        sravishankar wrote:

        I want to restrict user not to reduce the size of dialog within limits.

        That's what OnGetMinMaxInfo() is for. There is an example of it here (in the Extras section).


        "Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.

        "Judge not by the eye but by the heart." - Native American Proverb

        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