GDI使用方法小结(一)
来源:互联网 发布:java 异步写文件 编辑:程序博客网 时间:2024/06/04 22:34
一:DC相关
CDC* GetDC();
HDC* GetSafeHdc();
int ReleaseDC(CDC* pDC);
DC相关的类有:CDC, CClientDC, CPaintDC, CwindowDC, CMetaFileDC, 其中OnPaint()和OnDraw()函数只能使用CPaintDC类
二:画笔创建函数
1、构造函数:CPen(int nPenStyle, int nWidth, COLORREF crColor);
2、HPEN CreatePen(int nPenStyle, int nWidth, COLORREF crColor);
3、HGDIOBJ GetStockObject(int fnObject);参数有BLACK_PEN,NULL_PEN,WHITE_PEN
4、HPEN CreatePenIndirect(const LOGPNE* logpen);
LOGPEN 的定义为:
typedef struct tagLOGPEN
{
UINT lopnStyle;
POINT lopnWidth;
COLORREF lopnCOlor;
}LOGPEN
三:画刷创建函数
1、构造函数:CBrush(int fnStyle, COLORREF crColor);
2、HBRUSH CreateHatchBrush(int fnStyle, COLORREF crColor);
3、HGDIOBJ GetStockObject(int fnObject);参数有BLACK_BRUSH,GRAY_BRUSH,DKGRAY_BRUSH,NULL_BRUSH等
4、HBRUSH CreateBrushIndirect(CONST LOGBRUSH* lplb);
四:字体创建函数
1、HFONT CreateFont(
int nHeight, int nWidth, int nEscapement,
int nOrientation, int fnWeight, DWORD fdwltalic,
DWORD fdwUnderline, DWORD fdwStrikeOut, DWORD fwdCharSet,
DWORD fdwOutputPrecision, DWORD fdwClipPrecision,
DWORD fdwQuality,DWORD fdwPitchAndFamily,LPCTSTR lpszFace);
2、HGDIOBJ GetStockObject(int fnObject);参数有ANSI_FIXED_FONT, ANSI_VAR_FONT, SYSTEM_FONT等
3、BOOL CreateFontIndirect(Const LOGFONT* lpLogFont);
五:点的创建
WIN API点结构:typedef struct tagPOINT{LONG x; LONG y;}POINT
MFC点类为:CPoint
1、构造函数:CPoint(int x,int y);
2、CPoint(POINT pt);
3、CPoint(SIZE sz)或CPoint(CSIZE sz)
4、CPoint(DWORD dw)其中双字节dw的高位表示横坐标,低位表示纵坐标
六:矩形的创建
WIN API矩形结构体为RECT, MFC矩形类为CRect。
1、CRect();构造一个空矩形
2、CRect(int l,int t, int r, int b);
3、CRect(const RECT& srcRect);
4、CRect(LPCRECT lpSrcRect);
5、CRect(POINT point, SIZE size);
6、CRect(POINT topLeft, POINT bottomRight);
- GDI使用方法小结(一)
- GDI使用方法小结(二)
- GDI与GDI+编程小结
- 成员函数中const使用方法小结(一)
- GDI(一)
- 总结GDI+使用方法
- GDI+准备工作小结
- GDI编程小结
- GDI+编程小结
- GDI编程小结
- GDI+编程小结
- GDI+编程小结
- GDI内存泄露小结
- GDI+编程小结
- GDI编程小结
- GDI+编程小结
- GDI+编程小结
- GDI+编程小结
- 参数化
- MYSQL字符集的选择
- volatile关键字
- 递归求解二叉树任意一结点的深度
- 文件并发(日志处理)--队列--Redis+Log4Net
- GDI使用方法小结(一)
- 校招回忆录---骆驼篇
- JavaEE+Websocket入门遇到的问题
- enum hack
- Web标准结构语言—HTML
- 杨辉三角形
- 校招回忆录---小米篇
- iOS两个viewController之间传值
- 第十三周项目一 数组的大折腾(3)