📄 captureview.cpp
字号:
// CaptureView.cpp : implementation of the CCaptureView class
//
#include "stdafx.h"
#include "Capture.h"
#include "CaptureView.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCaptureView
IMPLEMENT_DYNCREATE(CCaptureView, CView)
BEGIN_MESSAGE_MAP(CCaptureView, CView)
//{{AFX_MSG_MAP(CCaptureView)
ON_WM_SIZE()
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCaptureView construction/destruction
CCaptureView::CCaptureView()
{
// TODO: add construction code here
}
CCaptureView::~CCaptureView()
{
}
BOOL CCaptureView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCaptureView drawing
void CCaptureView::OnDraw(CDC* pDC)
{
CCaptureDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CDC* m_dc= GetDC();
CDC dc;
dc.CreateCompatibleDC(m_dc);
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP2);
dc.SelectObject(bitmap);
CRect m_rect;
BITMAPINFO temp;
bitmap.GetObject(sizeof(temp),&temp);
this->GetClientRect(m_rect);
m_dc->StretchBlt(0,0,m_rect.right,m_rect.bottom,&dc,0,0,temp.bmiHeader.biWidth,temp.bmiHeader.biHeight,SRCCOPY);
bitmap.DeleteObject();
dc.DeleteDC();
}
/////////////////////////////////////////////////////////////////////////////
// CCaptureView printing
BOOL CCaptureView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CCaptureView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CCaptureView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CCaptureView diagnostics
#ifdef _DEBUG
void CCaptureView::AssertValid() const
{
CView::AssertValid();
}
void CCaptureView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCaptureDoc* CCaptureView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCaptureDoc)));
return (CCaptureDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCaptureView message handlers
void CCaptureView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
CFrameWnd* temp = GetParentFrame();
if (temp != NULL)
if (((CMainFrame*)(temp))->m_showed)
::SendMessage(temp->m_hWnd,WM_SIZE,0,0);
}
HBRUSH CCaptureView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CView::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Return a different brush if the default is not desired
return hbr;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -