LuvSea
Brush, Pen 응용 본문
LRESULT CALLBACK WndProc(HWND hWnd,UINT iMessage,WPARAM WParam,LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
HBRUSH Mybrush,Oldbrush;
HPEN Mypen,oldpen;
POINT pointList[3];
switch(iMessage){
case WM_PAINT:
hdc = BeginPaint(hWnd,&ps);
Mybrush = CreateHatchBrush(HS_CROSS,RGB(0,0,255));
//체크표 삼각형 만들기
hdc=GetDC(hWnd);
pointList[0].x =200;
pointList[0].y =100;
pointList[1].x =100;
pointList[1].y =200;
pointList[2].x =300;
pointList[2].y =200;
// Draw
Oldbrush =(HBRUSH)SelectObject(hdc,Mybrush);
Polygon(hdc, pointList, 3);
SelectObject(hdc,Oldbrush);
Mypen = CreatePen(PS_DASH,1,RGB(255,0,255));
oldpen = (HPEN)SelectObject(hdc,Mypen);
Rectangle(hdc,100,200,300,400);
SelectObject(hdc,oldpen);
DeleteObject(Mypen);
Mybrush = CreateHatchBrush(HS_DIAGCROSS,RGB(255,0,255));
Oldbrush = (HBRUSH)SelectObject(hdc,Mybrush);
Ellipse(hdc,100,200,300,400);
SelectObject(hdc,Oldbrush);
EndPaint(hWnd,&ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return(DefWindowProc(hWnd,iMessage,WParam,lParam));
}