If memory serves, you should be able to reduce that to something like:
Code:
CEditorDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CPaintDC dc(this); // device context for painting
CBrush aBrush( RGB(0,0,0) );
CRect aRect(0,0,100,100);
dc.FillRect(&aRect,&aBrush);
- The BeginPaint/EndPaint is being handled automatically by the construction/destruction of the CPaintDC.
- Using the constructor for the CRect makes things a little cleaner.
- RGB already returns a COLORREF, so no need to cast it.
- Using the CBrush constructor eliminates the call to CreateSolidBrush.
I don't know if this will fix your problem, but it might be worth a shot.