COffscreenDraw
Primary to the set is the offscreen memory DC and message map class, which replaces your ordinaryOnPaint()
and DoPaint()
with
an offscreen memory device. It's for that flicker-free look you've been looking for.
To use it, derive from COffscreenDraw<Base>
and
add the following to your message map...
BEGIN_MSG_MAP(Base)
CHAIN_MSG_MAP(COffscreenDraw<Base>)
...
END_MSG_MAP()
Remember to replace Base
with the name of the most
derived class.
Then implement the
DoPaint
method (if you handled the
WM_PAINT
or WM_ERASEBKGND
messages
yourself then remove these).
void DoPaint(CDCHandle dc)
{
// code code code
}
You must erase your background before you draw anything else
in DoPaint
.
CMemDC
TheCMemDC
class is the actual offscreen memory DC
used by the COffscreenDraw
message map class.
If you want to do specific offscreen custom drawing, use this instead.
CIcon and CIconHandle
TheHICON
all wrapped up.
This class is now part of the WTL framework itself.
CCursor and CCursorHandle
TheHCURSOR
handle in a class.
This class is now part of the WTL framework itself.
CAccelerator and CAcceleratorHandle
TheHACCEL
and its friends.
This class is now part of the WTL framework itself.
CLogFont
TheLOGFONT
font structure with plenty of helper functions.
This class is now part of the WTL framework itself.
CSaveDC
Wraps the::SaveDC()
and ::RestoreDC()
Win32 API
calls. Use it when you're in doubt if you're releasing all your GDI objects
properly.
CHandle
The new ATL Server library defines aCHandle
class. Here is a similar class
for older versions.
CMouseHover
This helper class adds the ability to getWM_MOUSEENTER
and WM_MOUSELEAVE
messages when the cursor hovers over
a window.
To use it, let the window derive from the class and chain it in the message map (place the chain at the top). Note that
WM_MOUSEENTER
is a private message.
Source Code Dependencies
Microsoft WTL 3.0 LibraryDownload Files
![]() | Source Code (6 Kb) |