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. Sizing my dialog

Sizing my dialog

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
7 Posts 6 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.
  • S Offline
    S Offline
    Sabry1905
    wrote on last edited by
    #1

    Hello All I am using a dialog as my main window, and I set it to center to screen I had put that code in the this->CenterWindow(CWnd::GetDesktopWindow()); //code here to set dialog size. on the OnInitDialog and i dont know how to set width and height of the dialog without using "SetWindowPos" and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks. any help?

    CPalliniC D H 3 Replies Last reply
    0
    • S Sabry1905

      Hello All I am using a dialog as my main window, and I set it to center to screen I had put that code in the this->CenterWindow(CWnd::GetDesktopWindow()); //code here to set dialog size. on the OnInitDialog and i dont know how to set width and height of the dialog without using "SetWindowPos" and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks. any help?

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

      A-M-S-S wrote:

      and i dont know how to set width and height of the dialog without using "SetWindowPos"

      Why do you dislike SetWindowPos?

      A-M-S-S wrote:

      and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks.

      Can't you handle WM_MOVE message?

      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

      In testa che avete, signor di Ceprano?

      I S 2 Replies Last reply
      0
      • CPalliniC CPallini

        A-M-S-S wrote:

        and i dont know how to set width and height of the dialog without using "SetWindowPos"

        Why do you dislike SetWindowPos?

        A-M-S-S wrote:

        and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks.

        Can't you handle WM_MOVE message?

        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

        I Offline
        I Offline
        Iain Clarke Warrior Programmer
        wrote on last edited by
        #3

        CPallini wrote:

        -- Iain Clarke

        I'm a sig! Fame at last! Iain.

        Iain Clarke appearing in spite of being begged not to by CPallini.

        CPalliniC 1 Reply Last reply
        0
        • S Sabry1905

          Hello All I am using a dialog as my main window, and I set it to center to screen I had put that code in the this->CenterWindow(CWnd::GetDesktopWindow()); //code here to set dialog size. on the OnInitDialog and i dont know how to set width and height of the dialog without using "SetWindowPos" and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks. any help?

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

          A-M-S-S wrote:

          and i dont know how to set width and height of the dialog without using "SetWindowPos"

          How about MoveWindow()?

          "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          1 Reply Last reply
          0
          • I Iain Clarke Warrior Programmer

            CPallini wrote:

            -- Iain Clarke

            I'm a sig! Fame at last! Iain.

            Iain Clarke appearing in spite of being begged not to by CPallini.

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

            Iain Clarke wrote:

            I'm a sig

            Yes, you're a sig_nore_, my friend. :)

            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

            In testa che avete, signor di Ceprano?

            1 Reply Last reply
            0
            • S Sabry1905

              Hello All I am using a dialog as my main window, and I set it to center to screen I had put that code in the this->CenterWindow(CWnd::GetDesktopWindow()); //code here to set dialog size. on the OnInitDialog and i dont know how to set width and height of the dialog without using "SetWindowPos" and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks. any help?

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              You can use of MoveWindow on the WM_SIZE event.

              1 Reply Last reply
              0
              • CPalliniC CPallini

                A-M-S-S wrote:

                and i dont know how to set width and height of the dialog without using "SetWindowPos"

                Why do you dislike SetWindowPos?

                A-M-S-S wrote:

                and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks.

                Can't you handle WM_MOVE message?

                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

                S Offline
                S Offline
                Schehaider_Aymen
                wrote on last edited by
                #7

                U can Use this OnInit.... CRect Rect; GetParentFrame()->GetWindowRect(&Rect); GetParentFrame()->SetWindowPos( NULL,0,0,900 ,200 ,SWP_NOMOVE | SWP_NOZORDER); SIZE size; size.cx=Rect.Width(); size.cy=Rect.Height()/2; SetScaleToFitSize(size);

                "The Ultimate Limit Is Only Your Imagination."

                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