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. increase the size of the DialogBox during RunTime

increase the size of the DialogBox during RunTime

Scheduled Pinned Locked Moved C / C++ / MFC
c++performancehelptutorial
7 Posts 4 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.
  • P Offline
    P Offline
    p_1960
    wrote on last edited by
    #1

    Hi, im using the below code to increase the size of the DialogBox along with the controls inside it during Runtime...ie im overriding DoModal()function... CTestDlgDlg is my application name.... INT_PTR CTestDlgDlg::DoModal() { CDialogTemplate dlt; int nResult; // load dialog template //CTestDlg::IDD is the ID of my resoource... if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1; // set your own font, for example "Arial", 10 pts. dlt.SetFont(L"Arial", 12); // get pointer to the modified dialog template LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate); // let MFC know that you are using your own template m_lpszTemplateName = NULL; InitModalIndirect(pdata); // display dialog box nResult = CDialog::DoModal(); // unlock memory object GlobalUnlock(dlt.m_hTemplate); return nResult; } The issue every control in the DialogBox is getting increased except checkbox,Radio button..please let me know can i increase the size of the checkbox,RadioButton in this case....

    S R 2 Replies Last reply
    0
    • P p_1960

      Hi, im using the below code to increase the size of the DialogBox along with the controls inside it during Runtime...ie im overriding DoModal()function... CTestDlgDlg is my application name.... INT_PTR CTestDlgDlg::DoModal() { CDialogTemplate dlt; int nResult; // load dialog template //CTestDlg::IDD is the ID of my resoource... if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1; // set your own font, for example "Arial", 10 pts. dlt.SetFont(L"Arial", 12); // get pointer to the modified dialog template LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate); // let MFC know that you are using your own template m_lpszTemplateName = NULL; InitModalIndirect(pdata); // display dialog box nResult = CDialog::DoModal(); // unlock memory object GlobalUnlock(dlt.m_hTemplate); return nResult; } The issue every control in the DialogBox is getting increased except checkbox,Radio button..please let me know can i increase the size of the checkbox,RadioButton in this case....

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

      I think you can the set the fonts in OnInitDialog function. Check these links How to use SetFont[^] How to set font for all child windows[^]

      -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

      My blog - Sharing My Thoughts

      P 1 Reply Last reply
      0
      • S Sarath C

        I think you can the set the fonts in OnInitDialog function. Check these links How to use SetFont[^] How to set font for all child windows[^]

        -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

        My blog - Sharing My Thoughts

        P Offline
        P Offline
        p_1960
        wrote on last edited by
        #3

        Thanks for ur Reply.... Font is getting increased with the piece of code which i posted but the control size is not getting increased....

        P 1 Reply Last reply
        0
        • P p_1960

          Thanks for ur Reply.... Font is getting increased with the piece of code which i posted but the control size is not getting increased....

          P Offline
          P Offline
          p_1960
          wrote on last edited by
          #4

          Anybody please let me know regarding the same....

          O 1 Reply Last reply
          0
          • P p_1960

            Hi, im using the below code to increase the size of the DialogBox along with the controls inside it during Runtime...ie im overriding DoModal()function... CTestDlgDlg is my application name.... INT_PTR CTestDlgDlg::DoModal() { CDialogTemplate dlt; int nResult; // load dialog template //CTestDlg::IDD is the ID of my resoource... if (!dlt.Load(MAKEINTRESOURCE(CTestDlg::IDD))) return -1; // set your own font, for example "Arial", 10 pts. dlt.SetFont(L"Arial", 12); // get pointer to the modified dialog template LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate); // let MFC know that you are using your own template m_lpszTemplateName = NULL; InitModalIndirect(pdata); // display dialog box nResult = CDialog::DoModal(); // unlock memory object GlobalUnlock(dlt.m_hTemplate); return nResult; } The issue every control in the DialogBox is getting increased except checkbox,Radio button..please let me know can i increase the size of the checkbox,RadioButton in this case....

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #5

            Hello, The last time I wanted to have dynamically resizable controls on my dialog, I used CResizableDialog[^]. I don't see why you need checkboxes and radio buttons to be enlarged along with the dialog. That sounds more like magnification/shrinking of the controls rather than dynamically resizing them. I don't see why you need to resize a checkbox though. But whatever floats your boat. :)

            It is a crappy thing, but it's life -^ Carlo Pallini

            P 1 Reply Last reply
            0
            • P p_1960

              Anybody please let me know regarding the same....

              O Offline
              O Offline
              Ozer Karaagac
              wrote on last edited by
              #6

              I have tested your DoModal() function in my system especially. I think, it works well. That is, all controls including check boxes and radio buttons resized proportionally as expected. I added some same-sized controls (e.g check box, radio buttton, combo box, push button, edit box, static) to my dialog at design time, all of them were still in same size when I run this dilaog with your DoModal(). As I said before, I think that the problem with your controls or any other place there of your project. If you find some more clue, we can help you better. Please try to set static edge style (WS_EX_STATICEDGE) of the problematic controls to see their boundaries exactly.

              1 Reply Last reply
              0
              • R Rajesh R Subramanian

                Hello, The last time I wanted to have dynamically resizable controls on my dialog, I used CResizableDialog[^]. I don't see why you need checkboxes and radio buttons to be enlarged along with the dialog. That sounds more like magnification/shrinking of the controls rather than dynamically resizing them. I don't see why you need to resize a checkbox though. But whatever floats your boat. :)

                It is a crappy thing, but it's life -^ Carlo Pallini

                P Offline
                P Offline
                p_1960
                wrote on last edited by
                #7

                because in our application dialogBox along with controls should resize based on the Resolution of the system... so that user will be able to have a clear view...

                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