Currently viewing: GipsySoft » Front Page» Articles

DrawBitmapStretched

Stretch draws a HBITMAP onto a HDC. The bitmap will fill the space specified by the width and height of cx and cy.

void DrawBitmapStretched( int x, int y, int cx, int cy, HDC hdc, HBITMAP hbm );

Return value

No return value

Example
This what a typical usage might look like in a WM_PAINT message handler

case WM_PAINT:
  {
    PAINTSTRUCT ps;
    BeginPaint( hwnd, &ps );
    HBITMAP hbm = LoadBitmap( GetModuleHandle( NULL )
        , MAKEINTRESOURCE( IDB_TEST ) );
    RECT rc;
    GetClientRect( hwnd, &rc );
    const int nWidth = rc.right - rc.left;
    const int nHeight = rc.bottom - rc.top;

    DrawBitmapStretched( 0, 0, nWidth, nHeight, ps.hdc, hbm );

    DeleteObject( hbm );

    EndPaint( hwnd, &ps );
  }
  break;

 

Click to view the source code

See also DrawBitmap DrawTiledBitmap