MFC常用绘图函数

(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;
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值