CPaintDC dc(this); // Creates a device context for the client area, which
// also erases the area to be drawn.
CPen MyPen, * pOldPen;
CBrush MyBrush, * pOldBrush;
// A red pen, one pixel wide
MyPen.Create(1, PS_SOLID, RGB(255,0,0));
// Selecting an object returns the old one
// we need to catch and return it to avoid memory leaks
pOldPen = dc.SelectObject(&MyPen);
// A Blue brush
MyBrush.CreateSolidBrush(RGB(0, 0, 255));
pOldBrush = dc.SelectObject(&MyBrush);
// Finally, we have our device context set up with our pen and brush and can
// use them to draw.
//Draws a rectangle that is red on the outside, filled in blue
dc.Rectangle(0, 0, 200, 200);
Open in new window
Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.