M
matt
I am trying to draw a rectangle in a dialog window. I put the code in
OnPaint(), even though I see a message put there by VC++ saying "Do
not call CDialog::OnPaint() for painting messages." I don't know what
that means.
The code below worked in one dialog window, but not in another. Any
idea what could cause this to work in one window but not in a similar
one? (there are no buttons or controls overlapping where the rectangle
should be)
CPaintDC dc(this); // device context for painting
CPoint upperLeft,lowerRight;
upperLeft.x=40;
upperLeft.y=40;
lowerRight.x=upperLeft.x+40;
lowerRight.y=80;
CRect recGraph(upperLeft.x,upperLeft.y,lowerRight.x,lowerRight.y);
CPen penBlack(PS_SOLID,2,RGB(0,0,0));
dc.SelectObject(&penBlack);
CBrush brGreen(RGB(92,200,92));
dc.SelectObject(&brGreen);
recGraph.DeflateRect(5,5);
dc.RoundRect(recGraph,CPoint(15,15));
OnPaint(), even though I see a message put there by VC++ saying "Do
not call CDialog::OnPaint() for painting messages." I don't know what
that means.
The code below worked in one dialog window, but not in another. Any
idea what could cause this to work in one window but not in a similar
one? (there are no buttons or controls overlapping where the rectangle
should be)
CPaintDC dc(this); // device context for painting
CPoint upperLeft,lowerRight;
upperLeft.x=40;
upperLeft.y=40;
lowerRight.x=upperLeft.x+40;
lowerRight.y=80;
CRect recGraph(upperLeft.x,upperLeft.y,lowerRight.x,lowerRight.y);
CPen penBlack(PS_SOLID,2,RGB(0,0,0));
dc.SelectObject(&penBlack);
CBrush brGreen(RGB(92,200,92));
dc.SelectObject(&brGreen);
recGraph.DeflateRect(5,5);
dc.RoundRect(recGraph,CPoint(15,15));