The example in this article describes how MFC draws irregular forms. Share to everyone for your reference. The specific analysis is as follows:
Implementation process:
1, first create an MFC application based on DLG, named: Trybgdlg, and set the Dlg property to: Title Bar:false, other settings unchanged
2, the production of two images, a black-and-white image, is based on the appearance of the player to make, where the white area is to retain the final display on the desktop area. Add these t
Hmetfile;
Hmetfile = M_dcmetafile.close ();
Save compatible DC
Copymetafile (Hmetfile, "c:\\copymetafile.wmf");
A look at the effect is very good,
Only the format WMF, to be loaded PDF words the road quite twists and turns,
And then I thought, the CDC can show in the interface why it can't be displayed in memory
So the code for the memory drawing appears
CDC MEMDC;
MEMDC. CreateCompatib
Cdc::setmapmode
virtual int setmapmode (int nmapmode );
Function Description: This function sets the mapping method for the specified device environment, which defines the unit of measure that converts logical units to unit units, and defines the direction of the X and Y axes of the device.
Nmapmode: Specifies the new mapping method, which can be any of the values listed below.
Mm_anisotropic: The logical unit is converted to any unit with any proport
Concept
J2ME, Java 2 Micro Edition, is a miniature Java platform running on mobile devices by Sun, with mobile devices, PDAs, electronic dictionaries, and a wide range of information terminals such as set-top boxes.Because of the tens of thousands of mobile terminals and the very different computing power, it is unlikely that just two or three versions of JVMs, like desktop systems, can satisfy Windows,linux and UNIX systems, so J2ME is not a simple miniature version of the JVM. To meet the dive
With a few gaps in the latest projects, starting with some of the bi features of SQL Server 2012 and 2014, referring to an example from Matt, we started to experience the CDC in SSIS (change data Capture).
Note: If you need to know about the CDC in SQL Server 2008, see here http://www.cnblogs.com/downmoon/archive/2012/04/10/2439462.html), This article assumes that the reader has an understanding of how the
Set the background color and background image of the dialog box in onctlcolor (), onerasebkgnd (), onpaint (). After the dialog box is initialized, onsize ()-> onerasebkgnd () is called for display (), -> onpaint ()-> onctlcolor (),
To change the dialog box size, for example, showwindow (sw_showmaximized); updatewindow ();
Showwindow calls onsize ()-> onerasebkgnd (),
Updatewindow (); Call onpaint ()-> onctlcolor (),
If the message response onerasebkgnd () is not set in the dialog box,
-frameworks, and views are created.3.2On_control_reflect (en_chage, onenchange) // message ing macro,Capture the message that the view content changes. In the message processing function:3.2.1 Save the content of the activity View to the document3.2.2 notify other views to obtain the latest data from the document3.3Rewrite the cview: onupdate () function. In the function, obtain the document data and displayTo the current view.The relationships between the four types are similar to those in a si
Source: http://www.cnblogs.com/volnet/articles/cpp_about_draw.html
First, record the point of the mouse, so add the code in wm_lbuttondown:
Void cdrawview: onlbuttondown (uint nflags, cpoint point)
{
// Todo: add the message processing program code and/or call the default value here
M_ptorigin = point;
Cview: onlbuttondown (nflags, point );
}
Record the position of the wm_lbuttonup point again to complete the following 1-3 tasks.
1. Draw a line
Void cdrawview: onlbuttonup (uint nflags, cpoint po
. If you set the background to null, the duplicate drawing will not flash. Of course, this will make the display of the window messy, because during the re-painting, there is no background color to clear the original drawing, and a new image is superimposed. Some people may say that the blinking is caused by the drawing speed being too slow or the display graphics being too complex. In fact, this is not true. The influence of the display speed of the drawing on the flashing is not fundamental.Fo
like
In the flash. If you set the background to null, the duplicate drawing will not flash.
Of course, this will make the display of the window messy, because there is no background color for the original
The drawn image is cleared, and the new image is superimposed.
Some people may say that flashing is caused by the drawing speed being too slow or the graphics displayed are too complex,
In fact, this is not true. The influence of the display speed of the drawing on the flicker is not fundament
device description table.
In MFC, the path layer is created using the beginpath and endpath functions provided by the CDC class. First, call the former function to open a path layer in the device description table, and then use the drawing function provided by the graphical device interface (GDI) for drawing operations, such as drawing some points, rectangle, elliptic, etc. After the Drawing operation is completed, the application closes the path lay
background to null, the duplicate drawing will not flash.Of course, this will make the display of the window messy, because during the re-painting, there is no background color to clear the original drawing, and a new image is superimposed.Some people may say that the blinking is caused by the drawing speed being too slow or the display graphics being too complex. In fact, this is not true. The influence of the display speed of the drawing on the flashing is not fundamental. For example, in ond
structure and defines a color. The rgbquad structure is defined as follows:Typedef struct tagrgbquad {
Bytergbblue; // blue brightness (value range: 0-255)Bytergbgreen; // The brightness of the green color (value range: 0-255)Bytergbred; // The Red brightness (value range: 0-255)Bytergbreserved; // reserved, must be 0} Rgbquad;The number of rgbquad structure data in the color table is determined by bibitcount:When bibitcount is 1, 4, and 8, there are 2, 16, and 256 table items respectively;When
//////////////////////////////////////////////////////////////////////// Construction/Destruction//////////////////////////////////////////////////////////////////////CP2::CP2(){x=0.0;y=0.0;}CP2::CP2(double x,double y){this->x=x;this->y=y;}CP2::~CP2(){}2) create a cline class
Header file: line. h
// Line.h: interface for the CLine class.////////////////////////////////////////////////////////////////////////#if !defined(AFX_LINE_H__8A91E283_F40D_4086_8BB8_7A9D9A6DB4D5__INCLUDED_)#define AFX
.
Requirements
OS versions:Windows CE 5.0 and later.
Header:Imaging. h.
Link Library:Imaging.
So it's easy.
/*************************************** **************************************** *****
*
* Function name showpng
* Function Introduction: Display PNG Images
* Entry parameter const wchar * filename, // file path
* Crect * prect, // display area
* CDC * PDC, // dc
* No Exit Parameter
* Return value void
*
*************************
CDC: setmapmode
Virtual int setmapmode (int Nmapmode );
Function Description: This function sets the ing mode for the specified device environment. The ing mode defines the conversion of the logical unit to the measurement unit of the device unit, and defines the direction of the X and Y axes of the device.
Nmapmode: Specifies the new ing mode. This parameter can be any value listed below.
Mm_anisotropic: converts the logical unit to any unit with any
see the missingSave the following code:
BOOL CMYView::OnEraseBkgnd(CDC* pDC) { return CView::OnEraseBkgnd(pDC);}
Is to call the onerasebkgnd function of the parent class. We can block this call and only directly return true.The following describes the steps for drawing the memory buffer.
Cbitmap bit; bit. loadbitmapa (idb_bitmap1); bitmap bm; bit. getbitmap ( BM); CDC memdc; memdc. createcompatibledc
Ii. draw lines
1. Use the global functions of the SDK to implement the draw line function
HDC;HDC =: getdc (m_hwnd );
Movetoex (HDC, m_ptorigin.x, m_ptorigin.y, null );Lineto (HDC, point. X, point. y );
: Releasedc (m_hwnd, HDC );
Note: A device description table DC must be obtained for drawing. After drawing, you must release the device description table resources.
2. Use the CDC class of MFC to implement the draw line function
set the background to null, redraw the imageWill not flash. Of course, this will make the display of the window messy, because during the re-painting, there is no background color to clear the original drawing, and a new image is superimposed. Some may say that flashing is because of painting.The speed of a graph is too slow or the graphic display is too complex. In fact, this is not true. The effect of the display speed on the flickering is not fundamental. For example, in ondraw (
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.