幽魂国度

 

CDC类对象的行为函数

(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 );
                                          B
OOL 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;

posted on 2010-03-29 22:15 阅读(830) 评论(1)  编辑 收藏 引用

评论

# re: CDC类对象的行为函数 2012-07-09 02:19 tianpeng

TextOut()的三个参数在2010中好像变了,博主不妨试试看,我的不知怎么回事提示参数不对  回复  更多评论   


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜