1. In stdafx. h
Comment out # define win32_lean_and_mean
Or add # include <windows. h>
Visual Studio 2012 does not seem to need to be changed by default.
2. Locate a CPP file and add:
# Include <gdiplus. h>
Using namespace gdiplus;
# Pragma comment (Lib, "gdiplus. lib ")
3. Add at the top of the winmain Function
Ulong_ptr token;
Gdiplusstartupinput GSI;
Gdiplusstartup (& token, & GSI, 0 );
4. Add at the bottom of winmain
Gdiplusshutdown (token );
5.
Add in wndproc
Case wm_paint:
HDC = beginpaint (hwnd, & PS );
// Todo: add any drawing code here...
Onpaint (HDC );
Endpaint (hwnd, & PS );
Break;
---------------
Add drawing function
Void onpaint (HDC ){
Graphics g (HDC );
Gdiplus: Image IMG (L "img.jpg ");
Pen (color (233,24, 22 ));
G. drawimage (& IMG, pointf ());
G. drawline (& pen, 100,100 );
And so on.
From:
Http://hi.baidu.com/kikoqiu/item/2e60f12b4dd123f850fd87d3