(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;