STEPS TO CREATE A RECTANGLE IN THE CLIENT REGION
1. Generate a SDI application and name it as a brush.
2. Handle the WM_LBUTTONDOWN message for the CBrushView object id.
3. In answer to Step 2 ON_WM_LBUTTONDOWN member the function would be inserted in the view accomplishment file as shown.
void CBrushView::OnLButtonDown(UINT nFlags, CPoint point)
4. Type the code below in the ON_WM_LBUTTONDOWN member function
//BOOL GetClientRect(LPRECT lpRect) const
5. Build and then execute the project.
6. A window with lines would be exhibited whenever the left button is pressed
7. Click the left button in various places and note the color change.
8. Transform the brush style as the HS_DIAGONAL, HS_VERTICAL, HS_HORIZONTAL, and HS_CROSS for various executions and examine the output.
The Get Client Rect function imprisons the rectangular window area and stores in m_rdRect object.
Select Stock Object makes a call to the CGdi Object :: From Handle() to verify which CGdiObject to return.
Figure: Affect of Rectangle Function