I'm not sure how to get the code I'm using to work. I need to add two separate rectangles to the
code already prepared, but it won't compile. The relevant code follows, so please help!
case WM_PAINT:
hdc = BeginPaint(hwnd,&ps);
// obtain a yellow pen for drawing walls of container in yellow
pen = CreatePen(PS_SOLID,4, RGB(255,255,0));
SelectObject(hdc,pen);
// obtain a black bruch to draw 'background' of container in black
blackBrush = CreateSolidBrush(RGB(0,0,0));
SelectObject(hdc,blackBrush);
// draw container and its walls
Rectangle(hdc,XL-10,YT-10,XR+10,YB+10);
DeleteObject(pen);
DeleteObject(blackBrush);
//draw the orifices (most relevant)
pen2 = CreatePen(PS_SOLID, 4, RGB(255, 255, 0));
SelectObject(hdc,pen2);
brush = CreateSolidBrush(RGB(255,255,0));
Rectangle(hdc, Mid - 1, 0, Mid, 380);
DeleteObject(pen2);
I'm not sure how to get the code I'm using to work. I need to add two separate rectangles to the
code already prepared, but it won't compile. The relevant code follows, so please help!
case WM_PAINT:
hdc = BeginPaint(hwnd,&ps);
// obtain a yellow pen for drawing walls of container in yellow
pen = CreatePen(PS_SOLID,4, RGB(255,255,0));
SelectObject(hdc,pen);
// obtain a black bruch to draw 'background' of container in black
blackBrush = CreateSolidBrush(RGB(0,0,0));
SelectObject(hdc,blackBrush);
// draw container and its walls
Rectangle(hdc,XL-10,YT-10,XR+10,YB+10);
DeleteObject(pen);
DeleteObject(blackBrush);
//draw the orifices (most relevant)
pen2 = CreatePen(PS_SOLID, 4, RGB(255, 255, 0));
SelectObject(hdc,pen2);
brush = CreateSolidBrush(RGB(255,255,0));
Rectangle(hdc, Mid - 1, 0, Mid, 380);
DeleteObject(pen2);
From MSDN:
SetDCPenColor(hdc, RGB(0,0,255));
// Drawing a rectangle with the current Device Context
Rectangle(hdc,100,300,200,400);