You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//文件 MemDC.h
|
|
//主要功能:
|
|
//
|
|
//程序编写: 2005-12-07
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
#include "afxwin.h"
|
|
#include "DrawLocal/MemAlloc.h"
|
|
|
|
class AFX_EXT_CLASS CMemoryDC : public CDC
|
|
{
|
|
public:
|
|
CMemoryDC(void);
|
|
virtual ~CMemoryDC(void);
|
|
|
|
public:
|
|
virtual BOOL Create(CSize &pImageSize,int nBPP=0, CDC* pDC=NULL);
|
|
virtual CSize GetSize(void);
|
|
virtual void Empty(void);
|
|
|
|
void Erase(COLORREF pColor);
|
|
void FromDC(CDC* pDC); //从指定DC获得显示内容
|
|
void Draw(CDC* pDC, int x, int y); //不拉伸显示
|
|
void Draw(CDC* pDC, int x, int y, int cx, int cy); //拉伸显示
|
|
|
|
BOOL WriteBitmap(LPCTSTR lpFileName, int nBt=0, BOOL bCompr=FALSE);
|
|
BOOL Save(LPCTSTR lpFileName);
|
|
BOOL CopyToClipboard(HWND hWnd=NULL);
|
|
|
|
static BOOL FileDialog(BOOL bOpenFileDialog , CString &name);
|
|
static CString GetFilterType(BOOL bOpenFileDialog);
|
|
|
|
HBITMAP Detach();
|
|
operator HBITMAP(void) const;
|
|
operator CMemoryDC*(); // Allow usage as a pointer
|
|
CMemoryDC* operator->() {return this;} // Allow usage as a pointer
|
|
|
|
protected:
|
|
CMemAlloc m_memAlloc;
|
|
CImage image;
|
|
CSize cImageSize;
|
|
HBITMAP m_hOldBitmap;
|
|
};
|
|
|
|
AFX_INLINE CMemoryDC::operator HBITMAP(void) const
|
|
{
|
|
return (HBITMAP)image;
|
|
}
|
|
|
|
AFX_INLINE CMemoryDC::operator CMemoryDC*()
|
|
{
|
|
return this;
|
|
}
|
|
|
|
AFX_INLINE CSize CMemoryDC::GetSize(void)
|
|
{
|
|
return cImageSize;
|
|
}
|