当前位置:网站首页>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
边栏推荐
- Advanced C - Section 3 - character functions and string functions
- Section 4 - arrays
- Clause 48: understand template metaprogramming
- C language learning log 1.16
- Section 3 - functions
- 【线程/多线程】线程的执行顺序
- Use of natural sorting comparable
- Clause 32: moving objects into closures using initialization capture objects
- 135. distribute candy
- Section 5 - Operator details
猜你喜欢
Simple-SR:Best-Buddy GANs for Highly Detailed Image Super-Resolution論文淺析
Ruoyi cloud startup tutorial (hand-held graphics)
Time display of the 12th Blue Bridge Cup
List collection concurrent modification exception
Search DFS and BFS
Section 8 - Practical commissioning techniques
Advanced C language - Section 1 - data storage
Simple SR: best buddy Gans for highly detailed image super resolution
BM1Z002FJ-EVK-001开机测评
Elliptic curve encryption
随机推荐
Case - simulated landlords (upgraded version)
Clause 30: be familiar with the failure of perfect forwarding
Logical point
Spice story
Metartc4.0 integrated ffmpeg compilation
C language learning log 10.11
UNO
C language learning log 10.10
Differences between string() and tostring() methods
Section 2 - branch and loop statements
Recursion and recursion
Case -- the HashSet set stores the student object and traverses
【线程/多线程】线程的执行顺序
C language learning log 1.22
C language learning log 10.19
Explain the opencv function cv:: add() in detail, and attach sample code and running results of various cases
Introduction to QT XML
Must know must know -c language keywords
Flex布局自适应失效的问题
Stepping on a horse (one stroke)