What is the best way to clear the screen before redrawing if using a Windows Device Context as your drawing surface
What is the best way to clear the screen before redrawing if using a Windows Device Context as your drawing surface
Use the ClearScreen() fuction that is part of whatever API your using.
Can't you FillRect() or something like that?
If you are filling white or black you can use those flags in BitBlt as a quick fill. Otherwise, you can use this as a faster alternative to FillRect:
Code:void PaintRect(HDC hdc, RECT *rect, COLORREF colour) { COLORREF oldcr = SetBkColor(hdc, colour); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, rect, "", 0, 0); SetBkColor(hdc, oldcr); }
"...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers
yea fillrect works thanks sand man
Nice guess wasn't it?Originally Posted by loopshot
HA, here is one better than both of your suggestins
but thank you all for the help guysCode:BOOL FloodFill( HDC hdc, // handle to DC int nXStart, // starting x-coordinate int nYStart, // starting y-coordinate COLORREF crFill // fill color );
FloodFill() is not better than FillRect().
FloodFill is more for filling areas with borders than it is for large areas. FillRect() simply creates a colored square the size of the rect specified. This is a much faster process. FloodFill() is a somewhat complex function and I wouldn't use it for what you want to do.
Thanks budda