|
// Anchor.cpp : implementation file
//
#include "stdafx.h"
#define A_LEFT 1
#define A_TOP 2
#define A_BOTTOM 4
#define A_RIGHT 8
void Anchor(CWnd *pWndParent, UINT ID, DWORD dwAnchor, CSize sizeOld, CSize sizeNew)
{
CWnd *pWnd = pWndParent->GetDlgItem(ID);
CRect rect;
pWnd->GetWindowRect(rect);
pWndParent->ScreenToClient(rect);
int nCx = sizeNew.cx-sizeOld.cx;
int nCy = sizeNew.cy-sizeOld.cy;
if((dwAnchor&A_LEFT) == 0)
rect.left += nCx;
if((dwAnchor&A_RIGHT) != 0)
rect.right += nCx;
if((dwAnchor&A_TOP) == 0)
rect.top += nCy;
if((dwAnchor&A_BOTTOM) != 0)
rect.bottom += nCy;
pWnd->MoveWindow(rect);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.