共用方式為


CImage::Attach

Attaches hBitmap to a CImage object.

void Attach(
   HBITMAP hBitmap, 
   DIBOrientation eOrientation = DIBOR_DEFAULT
) throw();

Parameters

  • hBitmap
    A handle to an HBITMAP.

  • eOrientation
    Specifies the orientation of the bitmap. Can be one of the following:

    • DIBOR_DEFAULT   The orientation of the bitmap is determined by the operating system. However, this may not always have the intended results on all operating systems. For more information on this, see the following Knowledge Base article (Q186586): PRB: GetObject() Always Returns Positive Height For DIB Sections.

    • **DIBOR_BOTTOMUP   **The lines of the bitmap are in reverse order. This causes CImage::GetBits to return a pointer near the end of the bitmap buffer and CImage::GetPitch to return a negative number.

    • **DIBOR_TOPDOWN  ** The lines of the bitmap are in top to bottom order. This causes CImage::GetBits to return a pointer to the first byte of the bitmap buffer and CImage::GetPitch to return a positive number.

Remarks

The bitmap can be either a non-DIB section bitmap or a DIB section bitmap. See IsDIBSection for a list of methods that you can use only with DIB section bitmaps.

Requirements

Header: atlimage.h

See Also

Reference

CImage Class

CImage::CImage

Other Resources

CImage Members