⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dibtevw.cpp

📁 API经典入门
💻 CPP
字号:
// dibtevw.cpp : implementation of the CDibtestView class
//

#include "stdafx.h"
#include "dibtest.h"

#include "dibtedoc.h"
#include "dibtevw.h"

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDibtestView

IMPLEMENT_DYNCREATE(CDibtestView, CView)

BEGIN_MESSAGE_MAP(CDibtestView, CView)
	//{{AFX_MSG_MAP(CDibtestView)
	ON_COMMAND(ID_BITMAP_DUMPINFO, OnBitmapDumpinfo)
	ON_COMMAND(ID_BITMAP_LOADFROMFILE, OnBitmapLoadfromfile)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDibtestView construction/destruction

CDibtestView::CDibtestView()
{
	// TODO: add construction code here
}

CDibtestView::~CDibtestView()
{
}

/////////////////////////////////////////////////////////////////////////////
// CDibtestView drawing

void CDibtestView::OnDraw(CDC* pDC)
{
	CDibtestDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	
	if (!pDoc->m_DIBitmap.DIBIsLoaded())
		return;

	BeginWaitCursor();
	pDoc->m_DIBitmap.DrawOnDC(pDC, 20, 20);
	EndWaitCursor();
}

/////////////////////////////////////////////////////////////////////////////
// CDibtestView diagnostics

#ifdef _DEBUG
void CDibtestView::AssertValid() const
{
	CView::AssertValid();
}

void CDibtestView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CDibtestDoc* CDibtestView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDibtestDoc)));
	return (CDibtestDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDibtestView message handlers

void CDibtestView::OnBitmapDumpinfo()
{
#ifdef _DEBUG
	BeginWaitCursor();
	GetDocument()->m_DIBitmap.Dump(afxDump);	
	EndWaitCursor();
#endif // _DEBUG
}

void CDibtestView::OnBitmapLoadfromfile()
{
	CDibtestDoc* pDoc = GetDocument();
	CFileDialog dlg(TRUE, NULL, "C:\\WINDOWS\\*.bmp");
	
	if (dlg.DoModal() == IDOK)
	{
		BeginWaitCursor();
		pDoc->m_DIBitmap.LoadFromDIB(dlg.GetPathName());
		pDoc->UpdateAllViews(NULL);
		EndWaitCursor();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -