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
::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}In the Open Class Wizard, locate the WM_CTLCOLOR message, overload the corresponding function OnCtlColor (), and add the following:Hbrush Ctestdlg::onctlcolor (cdc* PDC, cwnd* pWnd, UINT nCtlColor){Hbrush HBR = Cdialog::onctlcolor (PDC, PWnd, nCtlColor);if (pWnd = = this){return
Tencent Science and technology news 90 days day and night fighting, 8 designers painstaking ... September 26, QQ computer Butler 6.0 version of the official launch, once on the line to receive a sound of appreciation. Compared with the previous 6.0 version in the security, functional and other aspects have a greater improvement, especially in the interface design, visual effects, but also has a "revolutionary" upgrade, called a "visual feast"!
So how was this "visual feast" born? What kind of s
How do I throw (throw) an exception that is derived by cuserexception?
When I tried to catch a derived class exception, I got the following error "Error C2039: ' classcmyexception ': ' Not '" a ' cmyexception ' classcmyexception ': Undeclared identifier ' IsKindOf ': cannot convert parameter 1 from ' int* ' to ' const struct cruntimeclass* '
You must use Declare_dynamic () and implement_dynamic () macros to enable your Cmyexception class to be dynamically created. The catch macro wants to be a
transparency effect;SelectObject (MEMDC, Oldbitmap);DeleteDC (MEMDC);DeleteObject (bitmap);There is certainly a 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 ba
coordinate of the window is mapped to two pixels of the viewport.void Ctestview::ondraw (cdc* pDC) {Ctestdoc * PDoc = GetDocument ();CRect rect; Declaring a CRect class rectangle objectGetClientRect (rect); Use the member function of the CWnd class GetClientRect (LPRECT LPRECT) to get the client area sizePdc->setmapmode (Mm_anisotropic); Set mapping mode to Mm_anisotropicPdc->setwindowext (rect. Width (), Rect. Height ()); Setup windowPdc->setviewpo
1,CreateMFC AppwizardProject, selectOptional based on the document or dialog box.
2,Add two images, as shown in the following figure. The second image hollows out the middle part of the first image, that is, it deletes this part of the area to make the background transparent.
3,Add bitmap resources and import the two images above.
4,Create a base classCwndClassTransparentwnd,CodeAs follows:
Header file:
[CPP: Collapse]
+ Expand source
View plain
Copy
Print
?
user interfacesWe usually need to set a beautiful image as the basemap of our dialog.Program for drawingCodeSome problems may occur frequently in onpaint ().For example, drag a window and move it on the dialog.The dialog changes to gray until the action stops.This is because the program calls onerasebkgnd () immediately every time it needs to be re-painted ()Onerasebkgnd () draws the dialog into gray.The program will call onpaint () only after the action is stopped. Then the basemap we want to
To achieve pick-up, you only need to select the objects in the entity set to pick up the collection.
The mouse goes through the object set is a brilliant color, and the mouse selects the object is
Select an object from the object, and then add it to the selection set.
Therefore, a class is developed to operate on entity tokens and selection sets.
Typedef struct // Index Related to object pointer{Csolid * m_picksolid;Int index; // The Index associated with the pointer
} Pindex;
Typ
situation, it takes much less time to calculate a rect than to redraw the content that does not need to be repainted.2. Prohibit the system from deleting your windowThe system will help you remove the window with the specified background color when you need to re-draw the window. However, the area to be re-painted may be very small. Or, it takes a lot of computing to start before you redraw these things. At this time, you can disable the system from dropping the original image. Until you have c
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
2. Related plotting
1. Use the SDK to obtain the DC handle:HDC;HDC =: getdc (m_hwnd); // get the DC handleMovetoex (HDC, m_ptorigin.x, m_ptorigin.y, null );Lineto (HDC, point. X, point. y );: Releasedc (m_hwnd, HDC); // release the DC
2. Use the CDC class pointer and CWIN class member function to obtain the DC.CDC * PDC = getdc ();PDC-> moveTo (m_ptorigin );PDC-> lineto (point );Releasedc (PDC );
3. Use the cclientdc object. (The cclientdc class
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.