当前位置:网站首页>行情绘图课程大纲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个等边三角形
给矩形,圆, 等边三角形填充红色
边栏推荐
- UNO
- The games that you've tasted
- Implementing the driver registration initcall mechanism on stm32
- Case -- the HashSet set stores the student object and traverses
- CMB's written test -- data analysis
- Hidden implementation and decoupling, knowing Pimpl mode
- Luogu p1088 Martians
- 17.6 unique_ Lock details
- The problem of flex layout adaptive failure
- C language learning log 12.25
猜你喜欢

Ruoyi cloud startup tutorial (hand-held graphics)

BM1Z002FJ-EVK-001开机测评

Enhanced for loop

Metaltc4.0 stable release

Simple-SR:Best-Buddy GANs for Highly Detailed Image Super-Resolution论文浅析

C language learning log 1.22

C language learning log 12.5

QT realizes message sending and file transmission between client and server

Reductive elimination

Section 5 - Operator details
随机推荐
C language learning log 1.22
Draw a hammer
C language learning log 10.5
Gradient descent, learning rate
Simple-SR:Best-Buddy GANs for Highly Detailed Image Super-Resolution論文淺析
Clause 30: be familiar with the failure of perfect forwarding
What is the difference between ROM, ram and flash? SRAM、DRAM、PROM、EPROM、EEPROM
C language learning log 12.25
Use of natural sorting comparable
Wang Dao Chapter II linear table exercises
Std:: Map empty example
Enhanced for loop
CMB's written test -- data analysis
Modification and analysis of libcoap source code by Hongmeng device discovery module
The games that you've tasted
Clause 28: understanding reference folding
C language learning log 1.17
Optocoupler working principle function electric parameter application circuit
【线程/多线程】线程的执行顺序
QT brushes and brushes