📄 xtmemdc.h
字号:
#pragma once
//===========================================================================
// Summary:
// CXTMemDC is a CDC derived class. CXTMemDC is an extension of CDC
// that helps eliminate screen flicker when windows are resized, by
// painting to an off screen bitmap. The class then uses CDC::BitBlt
// to copy the bitmap back into the current device context after all
// items have been painted.
//===========================================================================
class CXTMemDC : public CDC
{
public:
//-----------------------------------------------------------------------
// Summary:
// Constructs a CXTMemDC object used for flicker free drawing.
// Parameters:
// pDC - A Pointer to the current device context.
// rect - Represents the size of the area to paint.
// clrColor - An RGB value that represents the current system
// face color of three dimensional display elements.
//-----------------------------------------------------------------------
CXTMemDC(CDC* pDC,const CRect& rect,COLORREF clrColor=GetSysColor(COLOR_3DFACE));
//-----------------------------------------------------------------------
// Summary:
// Destroys a CXTMemDC object, handles cleanup and deallocation
//-----------------------------------------------------------------------
virtual ~CXTMemDC();
public:
//-----------------------------------------------------------------------
// Summary:
// This member function is called to set the valid flag to false
// so that the off screen device context will not be drawn.
//-----------------------------------------------------------------------
void Discard();
//-----------------------------------------------------------------------
// Summary:
// This member function gets content from the given DC
//-----------------------------------------------------------------------
void FromDC();
//-----------------------------------------------------------------------
// Summary:
// This member function retrieves a reference to the CBitmap
// object associated with the memory device context.
// Returns:
// A reference to the CBitmap object associated with the memory
// device context.
//-----------------------------------------------------------------------
CBitmap& GetBitmap();
HBITMAP DetachBitmap();
protected:
CDC* m_pDC; // Saves the CDC passed in constructor.
BOOL m_bValid; // Flag used for autodraw in destructor.
CRect m_rc; // Rectangle of the drawing area.
CBitmap m_bitmap; // Off screen bitmap.
HBITMAP m_hOldBitmap; // Original GDI object.
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -