Use GDI + plotting in VC ++ 6.0
1. Configure the GDI + Environment in VC ++ 6.0
1.1 download the GDI + Library
There is no GDI + Library in VC ++ 6.0. FromHttp://www.crazy-bit.com/download/gdiplus.zipDownload.
1.2 copy the GDI + File
Decompress the downloaded file. Copy the include file to the include directory of the VC installation directory. It is recommended that you rename the file name containing the GDI + header file to gdiplus.
Copy the gdiplus. Lib file in the Lib file to the Lib folder in the VC installation directory.
1.3 configure VC ++ 6.0
Add the gdiplus folder in step 1 to tools> Options> directories of your VC ++ project.
2. Drawing instance
2.1 Add in stdafx. h
# Ifndef ulong_ptr
# Define ulong_ptr unsigned long *
# Endif
# Include <gdiplus. h>
Using namespace gdiplus;
2.2 Add a variable to * app class
Ulong_ptr m_gdiplustoken;
2.3 initialize GDI + in initinstance
Gdiplusstartupinput;
Gdiplusstartup (& m_gdiplustoken, & gdiplusstartupinput, null );
Note: Be sure to add it before m_pmainwnd-> showwindow (sw_show.
2.4 draw in ondraw
Graphics graphics (PDC-> m_hdc );
Pen (color (50,255, 0,255), 15 );
Pen. setdashstyle (dashstyledash );
Pen. setstartcap (linecaproundanchor );
Pen. setendcap (linecaparrowanchor );
graphics. drawline (& pen, 20, 20,300,100);
graphics. drawline (& pen, 300,100,600,100);