当前位置:网站首页>Course outline of market drawing 1- basic knowledge
Course outline of market drawing 1- basic knowledge
2022-06-13 05:09:00 【HQChart】
Course outline of market drawing 1- Basic knowledge of
canvas
HDC Canvas handle
Get canvas handle mode
- BeginPaint(), EndPaint(), Trigger InvalidateRect(), InvalidateRgn ()
Corresponding MFC Of OnPaint()void UIBlockList::OnPaint() { CPaintDC dc(this); ....... } - GetDC(), ReleaseDC() Corresponding MFC CClientDC Before release , Unable to get at
- GetWindowDC(), ReleaseDC() Corresponding MFC CWindowDC Before release , Unable to get at
resources
All resources are used as handles , Use resources in the canvas through functions **SelectObject()** load resources . Generally, it is best to restore after use
HGDIOBJ obj = ::SelectObject(hDC, Resource handle ); // Set up a resource , Returns the handle to the previous resource
::MoveToEx(hDC, x1, y1, NULL);
::LineTo(hDC, x2, y2);
::SelectObject(hDC, obj); // After use , Restore the resource to the last
Resources are released using DeleteObject() , A macro is usually used , Release the resource and set the resource handle to null
#ifndef DELETE_OBJECT
#define DELETE_OBJECT(obj) if (obj) {
::DeleteObject(obj); obj=NULL; }
#endif
written words
HFONT Font handle
Create a function CreateFontIndirect(), CreateFont()
Corresponding MFC class CFont
Common functions
Set font color SetTextColor()
Draw text DrawText(), TextOut()
Calculate the length of the text GetTextExtentPoint32()
Set background color SetBkMode()
brush
HBRUSH Brush handle
Create a function CreateBrushIndirect, CreateSolidBrush
Corresponding MFC class CBrush
Common functions
SetDCBrushColor() Only change the color , There will be no new objects
Fill rectangular block FillRect()
Draw a rectangle Rectangle()
Rounded rectangle RoundRect()
The ellipse Ellipse()
The pie chart Pie()
Arc Arc()
Irregular figures Polygon()
paint brush
HPEN Brush handle , Used to draw line segments
Create a function CreatePenIndirect,CreatePen
Corresponding MFC class CPen
Common functions
SetDCPenColor() Change the color , There will be no new objects
MoveToEx, LineTo
Exercise one

Draw the above figure on the canvas ,
Border around
Cut into pieces 4 A rectangle
The first 1 One is a parallel line ,45 Degree angle
The first 2 A rectangle , The space around is 10,
The first 3 Circle , The outer radius of the rectangle is 70%
The first 4 Two equilateral triangles
Give rectangle , round , Equilateral triangles are filled in red
边栏推荐
- CMB's written test -- data analysis
- Simple-SR:Best-Buddy GANs for Highly Detailed Image Super-Resolution论文浅析
- Section 3 - functions
- MySQL8.0.13安装教程(有图)
- Pycharm错误解决:Process finished with exit code -1073741819 (0xC0000005)
- String()和toString()方法得区别
- Differences between string() and tostring() methods
- Small project - household income and expenditure software (1)
- Redis plus instructions
- QT realizes message sending and file transmission between client and server
猜你喜欢

Elliptic curve encryption

Ruoyi cloud startup tutorial (hand-held graphics)

Must know must know -c language keywords

lookup

详解OpenCV的函数cv::add(),并附各种情况的示例代码和运行结果

QT client development -- driver loading problem of connecting to MySQL database

List collection concurrent modification exception

Brick story

Simple SR: best buddy Gans for highly detailed image super resolution

Section 5 - Operator details
随机推荐
metaRTC4.0稳定版发布
Explain the opencv function cv:: add() in detail, and attach sample code and running results of various cases
Clause 30: be familiar with the failure of perfect forwarding
Clause 26: avoid overloading universal reference types
【转载】C语言内存和字符操作函数大全
C language learning log 10.6
C language learning log 2.19
Article 29: assuming that the mobile operation does not exist, is expensive, and is not used
Clause 33: decltype is used for auto & type formal parameters, with std:: forward
Sort (internal sort) + external sort
Luogu p1012 guess
OpenCV中的saturate操作(饱和操作)究竟是怎么回事
priority inversion problem
Dynamic and static libraries
Configuration used by automatic teaching evaluation script
RT thread console device initialization
Must know must know -c language keywords
Gradient descent, learning rate
C language learning log 1.19
Chapter 13 abstraction: address space