Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

Preventing the sizing of the CView derived class

I have a CView derived class and i want to restrict sizing of this window till some specific size.

I tried to do this in OnSize() and OnWindowPosChanged() events, but they didn't work.

Can anybody post a few lines of code how to do this?

Thanks.
0
Mindo
Asked:
Mindo
  • 2
1 Solution
 
captainkirkCommented:
Is this an MDI or SDI app??

If you want the main frame to remain the same size, you can specify that it can't be resized by turning the WS_THICKFRAME style off in your main frame class' PreCreateWindow() function.
0
 
ZoppoCommented:
Hi Mindo,

override the WM_GETMINMAXINFO handler CWnd::OnGetMinMaxInfo() for the view's frame window class (the CChildFrame) and set min and max tracking size of the passed MINMAXINFO as you need them.

hope that helps,

ZOPPO
0
 
MDarlingCommented:
You should respond to WM_GETMINMAXINFO.

and set the ptMinTrackSize and ptMaxTrackSize to the same value that
you want your view to be.

regards,
Mike.
0
 
MDarlingCommented:
woah - Zoppo's too quick :)

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now