The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Clipping Output

After the user clicks Clip from the menu, the application uses the coordinates of the rectangle the user created to define a clipping region. After defining the clipping region and selecting it into the application's device context, the application redraws the bitmapped image. The application performs these tasks, as follows.

// These variables are required for clipping.  
static POINT ptUpperLeft; 
static POINT ptLowerRight; 
static POINT aptRect[5]; 
static POINT ptTmp; 
static POINTS ptsTmp; 
static BOOL fDefineRegion; 
static BOOL fRegionExists; 
static HRGN hrgn; 
static RECT rctTmp; 
int i; 
    switch (wParam) 
    case IDM_CLIP: 
    hdc = GetDC(hwnd); 
    // Retrieve the application's client rectangle and paint  
    // with the default (white) brush.  
    GetClientRect(hwnd, &rctTmp); 
    FillRect(hdc, &rctTmp, GetStockObject(WHITE_BRUSH)); 
    // Use the rect coordinates to define a clipping region.  
    hrgn = CreateRectRgn(aptRect[0].x, aptRect[0].y, 
        aptRect[2].x, aptRect[2].y); 
    SelectClipRgn(hdc, hrgn); 
    // Transfer (draw) the bitmap into the clipped rectangle.  
       0, 0, 
       bmp.bmWidth, bmp.bmHeight, 
       0, 0, 
    ReleaseDC(hwnd, hdc);