-
Notifications
You must be signed in to change notification settings - Fork 0
/
GraphicLayout.cpp
53 lines (38 loc) · 1.14 KB
/
GraphicLayout.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include"GraphicLayout.h"
ULONG_PTR m_gdiplusToken;
using namespace std;
void GraphicLayout::draw() {
//Gdiplus
Gdiplus::GdiplusStartupInput GdiplusStartupInput;
Gdiplus::GdiplusStartup(&m_gdiplusToken, &GdiplusStartupInput, NULL);
//
PAINTSTRUCT ps;
HBRUSH bkbrush = CreateSolidBrush(RGB(10,10,30));
RECT crect={0,0,1400,800};
HDC hdc = BeginPaint(pWnd, &ps);
HDC hmem = CreateCompatibleDC(hdc);
HBITMAP hMbmp=CreateCompatibleBitmap(hdc, crect.right - crect.left, crect.bottom - crect.top);
HGDIOBJ hOldSel=
SelectObject(hmem,hMbmp);
SelectObject(hmem,bkbrush);
//SelectObject(hdc,bkbrush);
//start drawing
FillRect(hmem, &crect, bkbrush);
for (int i = 0; i < data.size(); i++) {
data[i]->setDC(&hdc,&hmem);
if(data[i]!=status&&data[i]!=start)
data[i]->draw();
}
status->draw();
start->mode = showStartUP;
start->draw();
BitBlt(hdc,crect.left,crect.top,crect.right-crect.left,crect.bottom-crect.top,hmem,0,0,SRCCOPY);
EndPaint(pWnd, &ps);
DeleteObject(bkbrush);
DeleteObject(hMbmp);
SelectObject(hmem, hOldSel);
DeleteDC(hmem);
ReleaseDC(pWnd,hdc);
//
Gdiplus::GdiplusShutdown(m_gdiplusToken);
}