-------------------------------------------------------------------------------------------
This article turns from : http://blog.csdn.net/xuyongbeijing2008/article/details/8063801
-------------------------------------------------------------------------------------------
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 me
The big difference between the first call to Cdialog::onpaint () and the Last Call to Cdialog::onpaint () in the OnPaint () function is that if you do not pay attention to this problem there will be an unreasonable drawing problem-the effect is not coming out! After two hours of torture, the problem lies in the following lessons:the Cdialog::onpaint () function is called first in the OnPaint () function:[CPP]View PlainCopy
Add a bitmap background to the main form client area
void Cbackimag
alternately in a short period of time, making the display window appear flashing. 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 in
side to draw and display, so when displaying a frame of graphics, the slowdown is less flickering, so as to achieve smooth animation; and, graphics are directly displayed in the memory to the current form, so the speed is also very fast, so as to achieve high-speed animation. The following describes how to implement these technologies:1,Start VC ++ and create a single-document application supported by MFC.2,Select the menu item inertnew class to create a class inherited from the cbitmap class,
limit to the above approach, because not all parent windows can accept this special WM_PAINT message feature, but MSDN mentions that most controls have this feature, and you should be careful to read its document content.Third: If the above methods are not, then the most stupid way, the GDI function to brush the background of the child window, but you need to know the parent window background color, background bitmap and other information. For example, to fill the background of a child window w
users often ask: "Why can't the WM_ERASEBKGND message in the dialog box be found in class wizard? Is this message unavailable in the dialog box "? In fact, the dialog box is also a window, and it also contains the WM_ERASEBKGND message, but it is filtered out by the dialog filter used by the MFC class wizard (only in the display of the message window, does not really do not respond to this message), in order to highlight the exclusive message and control events in the dialog box during code wri
First load an image with ID idb_bitmap2
In testdlg. h:
Cbrush m_brbk; // defined in public
In testdlg. cpp:
Add the following to the oninitdialog () initialization function:
Bool ctestdlg: oninitdialog ()
{
Cdialog: oninitdialog ();
Cbitmap BMP;
BMP. loadbitmap (idb_bitmap2 );
M_brbk.createpatternbrush ( BMP );
BMP. deleteobject ();
Return true; // return true unless you set the focus to a control
}
Open the Class Wizard and find the wm_ctlcolor message. The onctlcolor () function is reloaded
content, in this way, the background color and the display image appear alternately in a short period of time, making the display window appear flashing. 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 t
, 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 originalThe 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 fundamental.For example, in ondraw (
wm_erasebkgnd in the message list of the dialog box.
Figure 2 modify a message Filter
Now you can use Class Wizard to add the message response function of wm_erasebkgnd and modify this function as follows:
Bool ccustdlgdlg: onerasebkgnd (CDC * PDC)
{
Crect rcclient;
Getclientrect ( rcclient );
PDC-> fillrect ( rcclient, m_brbkgnd );
Return true;
// Return cdialog: onerasebkgnd (PDC );}
M_brbkgnd is a cbrush, which has been initializ
For more information about how to use VC to open the mo extension symbol library, see the article "Custom symbol method (for Mo) in VC.
The key code is as follows:Public:Cpen g_hpen;// IcustomlineStdmethod (setupdc) (long HDC, double DPI, idispatch * pbasesym){CDC * pcdc = CDC: fromhandle (HDC );
// Cpen * g_hpen = createpen (pbasesym-> style, pbasesym-> size, pbasesym-> color );
Dispid;Dispparams dispparam
1.Picking handle
CDC problems:1. cdc dc; DC. lineto (point); cannot run
2. CDC * Dc = getdc (); DC-> lineto (point );There are a large number of handle packaging classes in MFC. As the name suggests, the so-called handle packaging class refers to these classes encapsulate the handles of System Objects (hwnd, HDC, hbitmap, etc.), and provides a group of functi
To modify the background color and text color of the CButton class button, you must redraw the button using a self-drawing method. This can be accomplished by defining a new button class that is based on the CButton class. The following is a concrete implementation method:method One:Add a new class, class name: Cbuttonex, base class: CButton.Add the following variables and function definitions to the header file CButtonEx.h:Privateint M_style; Button shape (0-Normal, 1-current, 2-pressed, 3-lock
1. Draw the lineMethod I: Use HDC (SDK mode)HDC HDC;HDC =:: GetDC (m_hwnd); Here to use the global:: GetDC, otherwise the default with CDC. Movetoex (HDC, point1.x, Point1.y, NULL); Movetoex, first move to the initial point, and then draw the line LineTo (HDC, point2.x, POINT2.Y);:: ReleaseDC (M_hwnd, HDC); Release also use global:: ReleaseDCMethod II: Using CDC (MFC mode)
From: http://www.cnblogs.com/seacode/archive/2010/06/17/1759616.html
To modify the background color and text color of a cbutton button, you must use the self-painting method to re-draw the button. This can be achieved by defining a new button class based on the cbutton class. The specific implementation methods are as follows:
Method 1:
Add a new Class, Class Name: cbuttonex, base class: cbutton.
Add the following variables and function definitions to the header file cbuttonex. h:
PR
Usb-hid is the abbreviation of human Interface device, which belongs to the Human-computer interaction operation device, such as USB mouse, USB keyboard, USB game joystick, USB touchpad, USB trackball, telephone dialing device, VCR remote control and so On. Tpyboard with Micropython In addition to the USB host feature, It can also be applied as a Usb-hid device, which focuses on if used as a mouse and Keyboard.first, as a mouse application(1) Edit the boot.py file to change how the Usb-mouse is
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.