(1)、常用的繪畫成員函數(shù):
SetPixel():用指定的顏色在指定的坐標(biāo)畫一個點,返回值為RGB顏色值;
函數(shù)原型
COLORREF SetPixel( int x, int y, COLORREF crColor );
COLORREF SetPixel( POINT point, COLORREF crColor );
MoveTo():移動當(dāng)前位置到指定的坐標(biāo),返回值為以前位置的坐標(biāo);
函數(shù)原型
CPoint MoveTo( int x, int y );
CPoint MoveTo( POINT point );
LineTo():從當(dāng)前位置到指定位置畫一條直線,成功返回非0;
函數(shù)原型
BOOL LineTo( int x, int y );
BOOL LineTo( POINT point );
Polyline():從當(dāng)前位置,繪畫多條曲線,成功返回非0;
函數(shù)原型
BOOL Polyline( LPPOINT lpPoints, int nCount/*數(shù)目*/ );
Rectangle():根據(jù)指定參數(shù)繪制一個矩形,成功返回非0;
函數(shù)原型
BOOL Rectangle( int x1, int y1, int x2, int y2 );
BOOL Rectangle( LPCRECT lpRect );
Ellipse(): 根據(jù)指定的矩形繪制一個內(nèi)切橢圓,成功返回非0;
函數(shù)原型
BOOL Ellipse( int x1, int y1, int x2, int y2 );
BOOL Ellipse( LPCRECT lpRect ); DrawIcon():在指定位置畫一個圖標(biāo),成功返回非0;
函數(shù)原型
BOOL DrawIcon( int x, int y, HICON hIcon );
BOOL DrawIcon( POINT point, HICON hIcon );
(2)、有關(guān)文本處理的常用函數(shù):
TextOut():在函數(shù)參數(shù)指定的位置顯示文本串。
函數(shù)原型
virtual BOOL TextOut( int x, int y, LPCTSTR lpszString, int nCount );
BOOL TextOut( int x,
int y,
const CString& str );
DrawText():在函數(shù)參數(shù)指定的矩形區(qū)域內(nèi)顯示文本串。
函數(shù)原型
virtual int DrawText( LPCTSTR lpszString, int nCount, LPRECT lpRect, UINT nFormat /*類型*/
);
int DrawText( const CString& str, LPRECT lpRect, UINT nFormat );
SetTextColor():設(shè)置顯示文本的顏色,返回當(dāng)前文本RGB顏色值;
函數(shù)原型
virtual COLORREF SetTextColor( COLORREF crColor );
GetTextColor():獲得當(dāng)前文本顏色; 函數(shù)原型
COLORREF GetTextColor( ) const;
SetBkColor():設(shè)置顯示文本的背景顏色,返回當(dāng)前文本背景RGB顏色值;
函數(shù)原型
virtual COLORREF SetBkColor( COLORREF crColor );
GetBkColor():獲得當(dāng)前文本背景顏色; 函數(shù)原型
COLORREF GetBkColor( ) const;
SetBkMode():設(shè)置文本的背景模式,返回當(dāng)前背景模式值;
函數(shù)原型
int SetBkMode( int nBkMode /*模式*/
); TRANSPARENT透明,
OPAQUE 不透明
GetBkMode():獲得當(dāng)前文本背景模式; 函數(shù)原型
int GetBkMode( ) const;
SetTextAlign():設(shè)置顯示文本的對齊方式,成功返回非0;
函數(shù)原型
UINT SetTextAlign( UINT nFlags );
GetTextAlign():獲得文本的對齊方式,函數(shù)原型
UINT GetTextAlign( ) const;