(1)、常用的绘画成员函数:
SetPixel():用指定的颜色在指定的坐标画一个点,返回值为RGB颜色值;
函数原型 COLORREF SetPixel( int x, int y, COLORREF crColor );
COLORREF SetPixel( POINT point, COLORREF crColor );
MoveTo():移动当前位置到指定的坐标,返回值为以前位置的坐标;
函数原型 CPoint MoveTo( int x, int y );
CPoint MoveTo( POINT point );
LineTo():从当前位置到指定位置画一条直线,成功返回非0;
函数原型 BOOL LineTo( int x, int y );
BOOL LineTo( POINT point );
Polyline():从当前位置,绘画多条曲线,成功返回非0;
函数原型 BOOL Polyline( LPPOINT lpPoints, int nCount/*数目*/ );
Rectangle():根据指定参数绘制一个矩形,成功返回非0;
函数原型 BOOL Rectangle( int x1, int y1, int x2, int y2 );
BOOL Rectangle( LPCRECT lpRect );
Ellipse(): 根据指定的矩形绘制一个内切椭圆,成功返回非0;
函数原型 BOOL Ellipse( int x1, int y1, int x2, int y2 );
BOOL Ellipse( LPCRECT lpRect );
DrawIcon():在指定位置画一个图标,成功返回非0;
函数原型 BOOL DrawIcon( int x, int y, HICON hIcon );
BOOL DrawIcon( POINT point, HICON hIcon );
(2)、有关文本处理的常用函数:
TextOut():在函数参数指定的位置显示文本串。
函数原型 virtual BOOL TextOut( int x, int y, LPCTSTR lpszString, int nCount );
BOOL TextOut( int x, int y, const CString& str );
DrawText():在函数参数指定的矩形区域内显示文本串。
函数原型 virtual int DrawText( LPCTSTR lpszString, int nCount, LPRECT lpRect, UINT nFormat /*类型*/);
int DrawText( const CString& str, LPRECT lpRect, UINT nFormat );
SetTextColor():设置显示文本的颜色,返回当前文本RGB颜色值;
函数原型 virtual COLORREF SetTextColor( COLORREF crColor );
GetTextColor():获得当前文本颜色; 函数原型 COLORREF GetTextColor( ) const;
SetBkColor():设置显示文本的背景颜色,返回当前文本背景RGB颜色值;
函数原型 virtual COLORREF SetBkColor( COLORREF crColor );
GetBkColor():获得当前文本背景颜色; 函数原型 COLORREF GetBkColor( ) const;
SetBkMode():设置文本的背景模式,返回当前背景模式值;
函数原型 int SetBkMode( int nBkMode /*模式*/); TRANSPARENT透明,OPAQUE 不透明
GetBkMode():获得当前文本背景模式; 函数原型 int GetBkMode( ) const;
SetTextAlign():设置显示文本的对齐方式,成功返回非0;
函数原型 UINT SetTextAlign( UINT nFlags );
GetTextAlign():获得文本的对齐方式,函数原型 UINT GetTextAlign( ) const;
SetPixel():用指定的颜色在指定的坐标画一个点,返回值为RGB颜色值;
函数原型 COLORREF SetPixel( int x, int y, COLORREF crColor );
COLORREF SetPixel( POINT point, COLORREF crColor );
MoveTo():移动当前位置到指定的坐标,返回值为以前位置的坐标;
函数原型 CPoint MoveTo( int x, int y );
CPoint MoveTo( POINT point );
LineTo():从当前位置到指定位置画一条直线,成功返回非0;
函数原型 BOOL LineTo( int x, int y );
BOOL LineTo( POINT point );
Polyline():从当前位置,绘画多条曲线,成功返回非0;
函数原型 BOOL Polyline( LPPOINT lpPoints, int nCount/*数目*/ );
Rectangle():根据指定参数绘制一个矩形,成功返回非0;
函数原型 BOOL Rectangle( int x1, int y1, int x2, int y2 );
BOOL Rectangle( LPCRECT lpRect );
Ellipse(): 根据指定的矩形绘制一个内切椭圆,成功返回非0;
函数原型 BOOL Ellipse( int x1, int y1, int x2, int y2 );
BOOL Ellipse( LPCRECT lpRect );
DrawIcon():在指定位置画一个图标,成功返回非0;
函数原型 BOOL DrawIcon( int x, int y, HICON hIcon );
BOOL DrawIcon( POINT point, HICON hIcon );
(2)、有关文本处理的常用函数:
TextOut():在函数参数指定的位置显示文本串。
函数原型 virtual BOOL TextOut( int x, int y, LPCTSTR lpszString, int nCount );
BOOL TextOut( int x, int y, const CString& str );
DrawText():在函数参数指定的矩形区域内显示文本串。
函数原型 virtual int DrawText( LPCTSTR lpszString, int nCount, LPRECT lpRect, UINT nFormat /*类型*/);
int DrawText( const CString& str, LPRECT lpRect, UINT nFormat );
SetTextColor():设置显示文本的颜色,返回当前文本RGB颜色值;
函数原型 virtual COLORREF SetTextColor( COLORREF crColor );
GetTextColor():获得当前文本颜色; 函数原型 COLORREF GetTextColor( ) const;
SetBkColor():设置显示文本的背景颜色,返回当前文本背景RGB颜色值;
函数原型 virtual COLORREF SetBkColor( COLORREF crColor );
GetBkColor():获得当前文本背景颜色; 函数原型 COLORREF GetBkColor( ) const;
SetBkMode():设置文本的背景模式,返回当前背景模式值;
函数原型 int SetBkMode( int nBkMode /*模式*/); TRANSPARENT透明,OPAQUE 不透明
GetBkMode():获得当前文本背景模式; 函数原型 int GetBkMode( ) const;
SetTextAlign():设置显示文本的对齐方式,成功返回非0;
函数原型 UINT SetTextAlign( UINT nFlags );
GetTextAlign():获得文本的对齐方式,函数原型 UINT GetTextAlign( ) const;