most simple type of graphic application in visual studio
Whats the most simple way (without much fancy stuff and no big setup overhead) to create a c++ project with visual studio where i can create some graphical debug output? (mainly drawing some lines开发者_Python百科, circles and triangles in a window. doesn't have to be performant or look pretty)
thanks!
The quickest way: create a new project, find or create the paint message handler (in Win32 it'll be in WndProc under "case WM_PAINT:", and in a WinForms (.net) project you'll override OnPaint), and add code to draw some stuff.
Well, for this I'll assume you would want to just use Gdi.
In a windows app, process the WM_PAINT message.
Here is an example that draws a rectangle:
case WM_PAINT: { HDC hDC; PAINTSTRUCT ps; hDC = BeginPaint(hwnd,&ps); Rectangle(hDC,10,10,30,30); EndPaint(hwnd,&ps); }
精彩评论