Derive a Cbuttonex classHeavy OnCreate using GDI + map to button
int cbuttonex::oncreate (lpcreatestruct lpcreatestruct) { if (cbutton::oncreate (lpcreatestruct) = =-1) RET Urn -1; CRect RC; GetClientRect (RC); CDC DC;usingnamespace gdiplus;//setting Graphics graph (GetDC ()->M_HDC) that must be used before GDI + is applied; Image Image (l "e:\\ picture related \ \ My works \\gdi+button.png"); Graph. DrawImage (image,0,0,rc.right-rc.left,rc.bottom-rc.
Label:I. What is covered in this article (Contents)
What is covered in this article (Contents)
Background (contexts)
Scenario (solution)
Scenario I (Solution one)
Programme II (Solution two)
Programme III (solution three)
Implementation (process)
Precautions (Attention)
References (References)
two. Background (contexts) In the SQL Server database, basic and group Two tables need to provide some fields to read to other programs, and
The so-called ing method is simply the coordinate arrangement method. The default ing method isMM_TEXT means that the X coordinates increase to the right, and the Y coordinates increase downward. () at the top left of the screen, each point in DC is a pixel on the screen. You may think this method is the best way to understand, but the relationship between a point and a pixel is normal on the screen, but it will be abnormal on the printer. Because our plot is in dot units and the resolution of t
1. How can I obtain the instance handle of an application?
The instance handle of the application is stored in cwinappim_hinstance.
Afxgetinstancdhandle to get the handle.
Example: handle hinstance = AfxGetInstanceHandle ();
2. How to get the pointer to the main window of the application through code?
The pointer of the main window is saved in cwinthread: m_pmainwnd, And the afxgetmainwnd implementation is called.
Afxgetmainwnd ()-> showwindow (sw_showmaxmized); // maximize the program.
3. How
); // load figBmp B. loadbitmap (idb_bitmapb); // load fig B
CDC dcback, DCA, and DCB; // declare three memory DC for drawingDcback. createcompatibledc ( DC );DCA. createcompatibledc ( DC );DCB. createcompatibledc ( DC); // create the three memory DC and the paintdc compatible DC
Poldback = dcback. SelectObject ( BMP back );Polda = DCA. SelectObject ( bmpa );Poldb = DCB. SelectObject ( bmp B); // select three bitmaps into the corresponding DC
DC. bitb
The first method (it should be the best way, you can modify the color of a single control, maybe other types of controls can also be used ):
First, we add the onctlcolor message ing function in the dialog box. For function functions, function prototypes, and parameter explanations, see the msdn description ~
Quote:
Cwnd: onctlcolor See alsoCwnd overview | class members | hierarchy chart | CDC: setbkcolorThe framework callthis member function when a
There are many ways to draw a device context. For example, you can create a bitmap image brush and use it to fill an area to draw an image. In addition, you can use the bitmap function of the CDC class to output the bitmap to the device context.
Bitblt is used to copy bitmap from the original device to the target device. The syntax format is as follows:
Boolbitblt (int x, int y, int nwidth, int nheight, CDC
m_pmainwnd = DLG; 5 // call before domodal (), set the dialog box to blue background, red text 6 setdialogbkcolor (RGB (255 ), RGB (255, 0, 0); 7 int nresponse = DLG. domodal (); 8 ...}
Compile and run. The background color and text color of the dialog box have changed. It is worth noting that setdialogbkcolor must be called before domodal () is called, and this method will change the color of all the dialogs in the application and cannot target a specified dialog box.
Method 2: Reload onpaint
message. The following example describes how to create a red background dialog.First, add the one-person member variable cbursh to the dialog base class:Class cmyformview: Public cformview{...PRIVATE:Cbrush M _ brush; // background brush...};Second, initialize the brush to the desired background color in the class constructor.Cmyformview: cmyformview (){// Initialize background brush.M_brush. createsolidbrush (RGB (0, 0,255 ))}Finally, use classwizard to process the wm_ctlcolor message and retu
The GDI bitmap is just another GDI object, such as a pen or font. You must first create a bitmap and then select it into the device environment. After modifying an object, you must unselect it and delete it.
Even so, there are still some problems because the "bitmap" of the display is actually the display surface image, and the "bitmap" of the printer device is the print page itself. Therefore, bitmap cannot be selected into the display device environment or printer device environment. You must
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 (CDC * PDC), write as follows:PDC-> moveTo (0, 0 );PDC-> lineto (100,100 );This drawing process should be very sim
analysis of the MFC program framework. Appwizard is a source code generation tool and a computer-aided programming tool. How is winmain hidden from the source program in the MFC program and how is theapp global variables allocated, the functions and relationships of several classes in the MFC framework, the generation and destruction of the window in the MFC framework, and the analysis of the precreatewidow and oncreate functions of the window class, the relationship between Windows and the cwn
Label: style ar use SP strong Div on art code
There are many ways to draw the device context. For example, you can create a bitmap image brush and use it to fill an area to draw an image. In addition, the bitmap function of the CDC class can be used to output the bitmap to the device context.
Bitblt is used to copy bitmap from the original device to the target device. The syntax format is as follows:
Boolbitblt (int x, int y, int nwidth, int
". Windows creates it and allocates system resources to it. After an MFC window object is created in Windows, it is created by the create member function of the cwnd class. The "window handle" is saved in the m_hwnd member variable of the window object. Windows windows can be destroyed by a program or by user actions.
(1) Data Structure comparison
The MFC object is an example of the corresponding C ++ class, which is defined by the MFC or programmer;
Windows Object is the internal structure of a
Functions:
1. Draw a colored line in an area of the dialog box.
2. When the window is overwritten and restored, the image is automatically re-painted.
3. Change the button color.
Operation:
Create a dialog box program according to the wizard. Add a static text box to the resource with the ID idc_static.
Add the following content to dialogxxxdlg. h:
Cbrush m_brush; // used for custom colorsCDC m_memdc; // memory DC compatible with screen DCCbitmap m_bmp; // bitmapCwnd * m_pdrawwnd; // Object Poin
Using TI's tm4c123g Launchpad Development Board, USB interface, to the same chip to burn write.We only use burn write that piece of function, do not have another chip development function, need jumper source project: from official website tm4c123g, download this board ofDrive, write program, Project。 Lmflashprogrammer.msi the program, drive and Project Sw-tm4c-2.0.1.11577.exe, tivaware_c_series-2.0.1.11577 project, examples\boards\ EK-TM4C123GXL for us to use the Chip project infrared screen sch
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.