I try to draw a rectangle on a mfc window using the instructions by: http://msdn.microsoft.com/en-US/library/8w4fzfxf%28v=VS.80%29.aspx . Much though I tried, the Rectangle appears on the border of the window covering the whole of it. What is the problem with the following code int the function OnDraw(CDC* pDC) ? What can be done to draw a Rectangle with particular coordinates in the window?
CPen penBlack;
penBlack.CreatePen(PS_SOLID, 3, RGB(0, 0, 0));
CPen* pOldPen = pDC->SelectObject(&penBlack);
CPoint pt(10, 10);
CSize sz(100, 50);
CRect myRect(pt, sz);
GetClientRect(&myRect);
pDC->Rectangle(&myRect);
GetClientRect
? It would seem that this call overwrites your previously set-up coordinates inmyRect
. – stakx - no longer contributing