You can use the CBitmapContext::Clear()
to clear a
rectangle to the current brush colour:
TRect largeBox(0,0,100,100);
TRect clearBox(20,20,40,40);
// draw a cross-hatched box
gc.SetBrushColor(KRgbDarkGray);
gc.SetBrushStyle(CGraphicsContext::ESquareCrossHatchBrush);
gc.DrawRect(largeBox);
// clear a small rectangle
gc.SetBrushColor(KRgbGray); // change the brush color
gc.Clear(clearBox); // clear to brush color
When clearing a rectangle, the brush style is ignored, even if
it is TBrushStyle::ENullBrush
.