gdi.h
上传用户:yangzi5763
上传日期:2007-01-02
资源大小:239k
文件大小:1k
源码类别:

ActiveX/DCOM/ATL

开发平台:

Visual C++

  1. #ifndef _GDINODESTACK
  2. #define _GDINODESTACK
  3. #include "stdafx.h"
  4. #include <afxtempl.h>
  5. struct CGdiNodeStack
  6. {
  7. CDC* m_pDC;
  8. CGdiObject* m_pGdiObject;
  9. CGdiObject* m_pSelectObject;
  10. CGdiNodeStack(CDC* pDC, CGdiObject* pGdiObject)
  11. {
  12. m_pDC = pDC;
  13. m_pGdiObject = pGdiObject;
  14. m_pSelectObject = m_pDC->SelectObject(m_pGdiObject);
  15. }
  16. ~CGdiNodeStack()
  17. {
  18. m_pDC->SelectObject(m_pSelectObject);
  19. }
  20. };
  21. struct CGdiStack : public CList<CGdiNodeStack*, CGdiNodeStack*>
  22. {
  23. void Push(CDC* pDC, CGdiObject* pGdiObject)
  24. {
  25. AddTail(new CGdiNodeStack(pDC, pGdiObject));
  26. }
  27. void Pop()
  28. {
  29. CGdiNodeStack* p = RemoveTail();
  30. delete p;
  31. }
  32. };
  33. #endif //_GDINODESTACK