Windows/MFC

Change Window Frame

aucd29 2013. 10. 2. 18:04
CreateRectRgn :
    BOOL CreateRectRgn( int x1, int y1, int x2, int y2 );

CombineRgn :
    int CombineRgn( CRgn* pRgn1, CRgn* pRgn2, int nCombineMode );

SetWindowRgn :
    void SetRectRgn( int x1, int y1, int x2, int y2 );
    void SetRectRgn( LPCRECT lpRect );

API///////////////////////////////////////////////////////////////////////////

[code]
WM_CREATE 메세지에서 처리를 해 주시면 됩니다.
void OnCreate(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
    HRGN WindowRgn, HoleRgn;

    WindowRgn = CreateRectRgn( 0, 0, 400, 300);
    HoleRgn = CreateRectRgn(100, 100, 200, 200);
    CombineRgn(WindowRgn, WindowRgn, HoleRgn, RGN_DIFF);
    SetWindowRgn(hwnd, WindowRgn, TRUE);
    DelectObject(HoleRgn);
}[/code]

MFC///////////////////////////////////////////////////////////////////////////

App : Member variable - CRgn WindowRgn, HoleRgn;
[code]
BOOL CRgnTestApp::InitInstance()
{
    ............... 생 략.................

    // The one and only window has been initialized, so show and update it.
    WindowRgn.CreateRectRgn( 0, 0, 400, 300);
    HoleRgn.CreateRectRgn(100, 100, 200, 200);
    WindowRgn.CombineRgn(&WindowRgn,&HoleRgn, RGN_DIFF);
    m_pMainWnd->SetWindowRgn(WindowRgn, TRUE);
    HoleRgn.DeleteObject();
    ............... 생 략.................
}[/code]