xtmemdc.h

来自「一款用与WINCE.0下播放MP3的播放软件,可以播放多中音频文件」· C头文件 代码 · 共 67 行

H
67
字号
#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 + =
减小字号Ctrl + -
显示快捷键?