added WindowHDC similar to Screen/MemoryHDC

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28103 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2004-06-30 15:44:11 +00:00
parent 9817a08533
commit 2ff56383e6

View File

@ -348,6 +348,22 @@ private:
DECLARE_NO_COPY_CLASS(ScreenHDC)
};
// the same as ScreenHDC but for window DCs
class WindowHDC
{
public:
WindowHDC(HWND hwnd) { m_hdc = ::GetDC(m_hwnd = hwnd); }
~WindowHDC() { ::ReleaseDC(m_hwnd, m_hdc); }
operator HDC() const { return m_hdc; }
private:
HWND m_hwnd;
HDC m_hdc;
DECLARE_NO_COPY_CLASS(WindowHDC)
};
// the same as ScreenHDC but for memory DCs: creates the HDC compatible with
// the given one (screen by default) in ctor and destroys it in dtor
class MemoryHDC