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. Simple Question: Resizing:

Simple Question: Resizing:

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
5 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.
  • Z Offline
    Z Offline
    zqueezy
    wrote on last edited by
    #1

    hey folks, i know how to create a window using create and giving it a rectangle region: Create(NULL, "Windows Application", WS_OVERLAPPEDWINDOW, CRect(120, 100, 700, 480), NULL); but how do I change the rectangle region... I mean clicking on a button and resizing the window to half or stuff (better to a Rectangle I calculate)??? I know it's simple but couldn't find a link thx in advance zqueezy

    Z CPalliniC N 3 Replies Last reply
    0
    • Z zqueezy

      hey folks, i know how to create a window using create and giving it a rectangle region: Create(NULL, "Windows Application", WS_OVERLAPPEDWINDOW, CRect(120, 100, 700, 480), NULL); but how do I change the rectangle region... I mean clicking on a button and resizing the window to half or stuff (better to a Rectangle I calculate)??? I know it's simple but couldn't find a link thx in advance zqueezy

      Z Offline
      Z Offline
      zqueezy
      wrote on last edited by
      #2

      well now I Found MoveWindow to SetThatRegion but all I get is a "Debug Assertion Failed!"... I actually wanted to to resize a subelement of my DialogClass. So I did a movewindow in my Dialog::OnSize(...) method. I guess the error comes from the initialization where there isn't any SubElement (although it's initialized but maybe not visible?) because GetWindowRect also fails with the same assertion failed

      1 Reply Last reply
      0
      • Z zqueezy

        hey folks, i know how to create a window using create and giving it a rectangle region: Create(NULL, "Windows Application", WS_OVERLAPPEDWINDOW, CRect(120, 100, 700, 480), NULL); but how do I change the rectangle region... I mean clicking on a button and resizing the window to half or stuff (better to a Rectangle I calculate)??? I know it's simple but couldn't find a link thx in advance zqueezy

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

        SetWindowPos[^] :)

        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.

        In testa che avete, signor di Ceprano?

        Z 1 Reply Last reply
        0
        • CPalliniC CPallini

          SetWindowPos[^] :)

          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.

          Z Offline
          Z Offline
          zqueezy
          wrote on last edited by
          #4

          yeah so obvious, I didn't even think of it thx

          1 Reply Last reply
          0
          • Z zqueezy

            hey folks, i know how to create a window using create and giving it a rectangle region: Create(NULL, "Windows Application", WS_OVERLAPPEDWINDOW, CRect(120, 100, 700, 480), NULL); but how do I change the rectangle region... I mean clicking on a button and resizing the window to half or stuff (better to a Rectangle I calculate)??? I know it's simple but couldn't find a link thx in advance zqueezy

            N Offline
            N Offline
            Nelek
            wrote on last edited by
            #5

            Hi, another way to do this is to change the CSize into ChildFrm.cpp in the function PrecreateWindow () For xample: i make different window sizes depending of the parent element of the window

            BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
            { if( !CMDIChildWnd::PreCreateWindow(cs) )
            return FALSE;

            //Set the configuration for the NewViews
            CMDIChildWnd\* pMDIActive = MDIGetActive();
            CDocument\* pDoc = pMDIActive->GetActiveDocument();
            
            if ((pDoc) && (pDoc->m\_szNewFrameName != ""))
            {	cs.style = WS\_SYSMENU | WS\_CAPTION | WS\_OVERLAPPED;
            
            	if (pDoc->m\_pObject1 || pDoc->m\_pObject2)
            	{	cs.cx = 415;		cs.cy = 260;	}
            	else if (pDoc->m\_pObject3->m\_nType == 0)
            	{	cs.cx = 517;		cs.cy = 421;	}
            	else if (pDoc->m\_pObject3->m\_nType == 2)
            	{	cs.cx = 610;		cs.cy = 435;	}
            
            	cs.lpszName = pDoc->m\_szNewFrameName;
            }
            return TRUE;
            

            }

            With this I put the caption of the new view according to the name of the element and some other parameters, and the size according to the type of the element.

            Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?

            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