forked from Yuri213212/tetris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drawicon.h
65 lines (61 loc) · 1.53 KB
/
drawicon.h
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
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef DRAWICON_H_
#define DRAWICON_H_
HICON drawIcon(){
const BYTE ANDmaskIcon[]={
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00,
0x00,0x00
};
const BITMAP bitmapmask={0,16,16,2,1,1,(void *)ANDmaskIcon};
static ICONINFO iconinfo={TRUE};
HDC hdc,hdcMem;
HBRUSH hBrushRed,hBrushBlue;
HICON hIcon;
hdc=GetDC(NULL);
hdcMem=CreateCompatibleDC(hdc);
iconinfo.hbmMask=CreateBitmapIndirect(&bitmapmask);
iconinfo.hbmColor=CreateCompatibleBitmap(hdc,16,16);
ReleaseDC(NULL,hdc);
SelectObject(hdcMem,iconinfo.hbmColor);
hBrushRed=CreateSolidBrush(RGB(255,0,0));
hBrushBlue=CreateSolidBrush(RGB(0,0,255));
SelectObject(hdcMem,GetStockObject(NULL_PEN));
SelectObject(hdcMem,GetStockObject(WHITE_BRUSH));
Rectangle(hdcMem,0,0,17,17);
SelectObject(hdcMem,hBrushRed);
Rectangle(hdcMem,0,8,5,17);
Rectangle(hdcMem,8,12,17,17);
SelectObject(hdcMem,hBrushBlue);
Rectangle(hdcMem,4,0,9,13);
Rectangle(hdcMem,8,4,13,9);
SelectObject(hdcMem,GetStockObject(GRAY_BRUSH));
Rectangle(hdcMem,5,1,8,4);
Rectangle(hdcMem,5,5,8,8);
Rectangle(hdcMem,9,5,12,8);
Rectangle(hdcMem,1,9,4,12);
Rectangle(hdcMem,5,9,8,12);
Rectangle(hdcMem,1,13,4,16);
Rectangle(hdcMem,9,13,12,16);
Rectangle(hdcMem,13,13,16,16);
DeleteObject(hBrushRed);
DeleteObject(hBrushBlue);
hIcon=CreateIconIndirect(&iconinfo);
DeleteDC(hdcMem);
DeleteObject(iconinfo.hbmMask);
DeleteObject(iconinfo.hbmColor);
return hIcon;
}
#endif