当前位置:网站首页>行情绘图课程大纲1-基础知识
行情绘图课程大纲1-基础知识
2022-06-13 05:03:00 【HQChart】
画布
HDC 画布句柄
获取画布句柄方式
- BeginPaint(), EndPaint(), 触发 InvalidateRect(), InvalidateRgn ()
对应MFC的OnPaint()void UIBlockList::OnPaint() { CPaintDC dc(this); ....... }
- GetDC(), ReleaseDC() 对应MFC CClientDC 在释放以前,无法在获取
- GetWindowDC(), ReleaseDC() 对应MFC CWindowDC 在释放以前,无法在获取
资源
所有的资源都是以句柄的方式使用,在画布里面使用资源通过函数**SelectObject()**加载资源.一般使用完以后最好还原
HGDIOBJ obj = ::SelectObject(hDC, 资源句柄); //设置一个资源,返回上一个资源的句柄
::MoveToEx(hDC, x1, y1, NULL);
::LineTo(hDC, x2, y2);
::SelectObject(hDC, obj); //使用完成以后, 资源还原成上一次的
资源释放都是使用 DeleteObject() ,一般会使用一个宏,释放资源并且资源句柄设置为空
#ifndef DELETE_OBJECT
#define DELETE_OBJECT(obj) if (obj) {
::DeleteObject(obj); obj=NULL; }
#endif
文字
HFONT 字体句柄
创建函数 CreateFontIndirect(), CreateFont()
对应MFC类 CFont
常用函数
设置字体颜色 SetTextColor()
绘制文字 DrawText(), TextOut()
计算文字长度 GetTextExtentPoint32()
设置背景色 SetBkMode()
刷子
HBRUSH 刷子句柄
创建函数 CreateBrushIndirect, CreateSolidBrush
对应MFC类CBrush
常用函数
SetDCBrushColor() 只修改颜色,不会有新的对象
填充矩形块 FillRect()
绘制长方形 Rectangle()
圆角矩形 RoundRect()
椭圆 Ellipse()
饼图 Pie()
弧线 Arc()
不规则图形 Polygon()
画笔
HPEN 画笔句柄, 用来绘制线段
创建函数 CreatePenIndirect,CreatePen
对应MFC类CPen
常用函数
SetDCPenColor() 修改颜色,不会有新的对象
MoveToEx, LineTo
练习一
在画布绘制上面的图形,
四周边框
切成4个矩形
第1个是平行线,45度角
第2个矩形, 四周间距都是10,
第3个圆,半径为外部矩形长的70%
第4个等边三角形
给矩形,圆, 等边三角形填充红色
边栏推荐
- 1.2 differences caused by keywords
- Luogu p1088 Martians
- Optocoupler working principle function electric parameter application circuit
- Hidden implementation and decoupling, knowing Pimpl mode
- Spread your wings and soar
- 【多线程编程】Future接口获取线程执行结果数据
- Red Treasure Book Reading Notes (continuously updated)
- Ruoyi cloud startup tutorial (hand-held graphics)
- COAP protocol libcoap API
- String()和toString()方法得区别
猜你喜欢
随机推荐
C language learning log 10.11
Section 3 - functions
2021TPAMI/图像处理:Exploiting Deep Generative Prior for Versatile Image Restoration and Manipulation
Draw a hammer
Bomb disposal cat
语音信号分帧的理解
Case - random numbers without repetition (HashSet and TreeSet)
System file interface open
Search DFS and BFS
Recursion and recursion
135. distribute candy
Section 2 - branch and loop statements
Wang Dao Chapter II linear table exercises
COAP protocol libcoap API
RT thread console device initialization
QT realizes message sending and file transmission between client and server
Force buckle 92 Reverse linked list II
Chapter 17 free space management
C language exercise 1
Common skills in embedded programming