Window sizing code

Started by sukishan, Jul 12, 2009, 11:04 PM

previous topic - next topic
Go Down


Window sizing

WM_SIZE: When using an application, one of the actions a user can perform on a window is to change its size, provided the window allows this. Also, from time to time, if the window allows it, the user can minimize, maximize, or restore a window. Whenever any of these actions occur, the operating system must keep track of the size of a window. When the size of a window has changed, the window sends the ON_WM_SIZE message. Its syntax is:

afx_msg void OnSize(UINT nType, int cx, int cy);The nType argument specifies what type of action to take. It can have one of the following values:

SIZE_MINIMIZED: The window has been minimized.
SIZE_MAXIMIZED: The window has been maximized.
SIZE_RESTORED: The window has been restored from being maximized or minimized.
SIZE_MAXHIDE: Another window, other than this one, has been maximized.
SIZE_MAXSHOW: Another window, other than this one, has been restored from being maximized or minimized.
The cx argument specifies the new width of the client area of the window.

The cy argument specifies the new height of the client area of the window.

To use this message, you should first call its implementation in the parent class before implementing the behavior you want. This can be done as follows:

void CAnyWindow::OnSize(UINT nType, int cx, int cy)
    CParentClass::OnSize(nType, cx, cy);
    // TODO: Add your message handler code here
}WM_SIZING: While the user is changing the size of a window, a message called ON_WM_SIZING is being sent. Its syntax is:

afx_msg void OnSizing(UINT nSide, LPRECT lpRect);When a user is resizing a window, he or she typically drags one of the borders or corners on a direction of his or her choice. The first argument, nSize, indicates what edge is being moved when resizing the window. It can have one of the following values:

WMSZ_BOTTOM: Bottom edge
WMSZ_BOTTOMLEFT: Bottom-left corner
WMSZ_BOTTOMRIGHT: Bottom-right corner
WMSZ_LEFT: Left edge
WMSZ_RIGHT: Right edge
WMSZ_TOP: Top edge
WMSZ_TOPLEFT: Top-left corner
WMSZ_TOPRIGHT: Top-right corner
A good beginning makes a good ending

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens Web Designing Chennai | GinGly :: Build your Personal Website | CineBuzz :: Cinema News | My Kids Diary :: Gift your Kids Memories :: Book Website @ 349 Rs monthly
Copyright 2005 - 2021 :: IT Acumens :: All Rights Reserved. :: XML Sitemap
ITAcumens Discussion Forum with 2 lakhs post running for 15 years - Powered by IT Acumens Pro Dedicated Server

My Kids Diary