为设备环境(DCdevice context)选择一个对象
CPen* SelectObject(
CPen* pPen
);
CBrush* SelectObject(
CBrush* pBrush
);
virtual CFont* SelectObject(
CFont* pFont
);
CBitmap* SelectObject(
CBitmap* pBitmap
);
int SelectObject(
CRgn* pRgn
);
CGdiObject* SelectObject(
CGdiObject* pObject
);
参数
pPen
A pointer to a CPen object to be selected.
pBrush
A pointer to a CBrush object to be selected.
pFont
A pointer to a CFont object to be selected.
pBitmap
A pointer to a CBitmap object to be selected.
pRgn
A pointer to a CRgn object to be selected.
pObject
A pointer to a CGdiObject object to be selected.
返回值
一个指向的对象被替换。这个指针所指向的对象是继承自CGdiObject,比如CPen ,如果返回值是NULL就代表出错。这个函数应该返回的是一个指向临时对象的指针,这个临时对象只在窗口消息的过程中有效。更多信息请参阅CGdiObject::FromHandle.
The version of the member function that takes a region parameter performs the same task as the SelectClipRgn member function.返回值可能是如下:
COMPLEXREGION New clipping region has overlapping borders.
ERROR Device context or region 无效.
NULLREGION New clipping region 为空.
SIMPLEREGION New clipping region has no overlapping borders.
CPen* SelectObject(
CPen* pPen
);
CBrush* SelectObject(
CBrush* pBrush
);
virtual CFont* SelectObject(
CFont* pFont
);
CBitmap* SelectObject(
CBitmap* pBitmap
);
int SelectObject(
CRgn* pRgn
);
CGdiObject* SelectObject(
CGdiObject* pObject
);
参数
pPen
A pointer to a CPen object to be selected.
pBrush
A pointer to a CBrush object to be selected.
pFont
A pointer to a CFont object to be selected.
pBitmap
A pointer to a CBitmap object to be selected.
pRgn
A pointer to a CRgn object to be selected.
pObject
A pointer to a CGdiObject object to be selected.
返回值
一个指向的对象被替换。这个指针所指向的对象是继承自CGdiObject,比如CPen ,如果返回值是NULL就代表出错。这个函数应该返回的是一个指向临时对象的指针,这个临时对象只在窗口消息的过程中有效。更多信息请参阅CGdiObject::FromHandle.
The version of the member function that takes a region parameter performs the same task as the SelectClipRgn member function.返回值可能是如下:
COMPLEXREGION New clipping region has overlapping borders.
ERROR Device context or region 无效.
NULLREGION New clipping region 为空.
SIMPLEREGION New clipping region has no overlapping borders.
备注
CDC类提供了五种GDI对象,包括 pens, brushes, fonts, bitmaps, and regions。新选入的对象代替了以前的对象For example, if pObject of the general version of SelectObject points to a CPen object, the function replaces the current pen with the pen specified by pObject.
应用程序一次可以选择一个且只能是一个位图到内存DC(memory device contexts )。位图的格式必须是单色或者compatible with the device context(适配于DC的),如果不是,就会返回一个错误
对于windows3.1以后, the SelectObject function 都返回一样的值,无论是否使用metafile( the SelectObject function returns the same value whether it is used in a metafile or not.)在以前版本的windows,当使用metafile,SelectObject会返回非零如果成功,零失败。(SelectObject returned a nonzero value for success and 0 for failure when it was used in a metafile.)
参见
CDC Overview | Class Members | Hierarchy Chart | CGdiObject::DeleteObject | CGdiObject::FromHandle | CDC::SelectClipRgn | CDC::SelectPalette | SelectObject
CDC类提供了五种GDI对象,包括 pens, brushes, fonts, bitmaps, and regions。新选入的对象代替了以前的对象For example, if pObject of the general version of SelectObject points to a CPen object, the function replaces the current pen with the pen specified by pObject.
应用程序一次可以选择一个且只能是一个位图到内存DC(memory device contexts )。位图的格式必须是单色或者compatible with the device context(适配于DC的),如果不是,就会返回一个错误
对于windows3.1以后, the SelectObject function 都返回一样的值,无论是否使用metafile( the SelectObject function returns the same value whether it is used in a metafile or not.)在以前版本的windows,当使用metafile,SelectObject会返回非零如果成功,零失败。(SelectObject returned a nonzero value for success and 0 for failure when it was used in a metafile.)
参见
CDC Overview | Class Members | Hierarchy Chart | CGdiObject::DeleteObject | CGdiObject::FromHandle | CDC::SelectClipRgn | CDC::SelectPalette | SelectObject