📄 sdi_projectview.cpp
字号:
// SDI_projectView.cpp : implementation of the CSDI_projectView class
//
#include "stdafx.h"
#include "SDI_project.h"
#include "SDI_projectDoc.h"
#include "SDI_projectView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSDI_projectView
IMPLEMENT_DYNCREATE(CSDI_projectView, CView)
BEGIN_MESSAGE_MAP(CSDI_projectView, CView)
//{{AFX_MSG_MAP(CSDI_projectView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CSDI_projectView construction/destruction
CSDI_projectView::CSDI_projectView()
{
// TODO: add construction code here
m_frame.Create( GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), 24);
}
CSDI_projectView::~CSDI_projectView()
{
}
BOOL CSDI_projectView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CSDI_projectView drawing
void CSDI_projectView::OnDraw(CDC* pDC)
{
CSDI_projectDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
IplImage* img = pDoc ->m_image;
CvSize size = pDoc ->m_size;
IplImage* ShownImage;
if (img)
{
CRect r;
GetClientRect (&r);
ShownImage = m_frame.GetImage();
cvSetImageROI( ShownImage , cvRect( 0, 0, size.width,size.height));
cvResize ( img, ShownImage, CV_INTER_LINEAR );
}
else {
return;
};
if (ShownImage)
{
m_frame.Show(pDC->GetSafeHdc() , 0, 0, size.width, size.height, 0, 0 );
ReleaseDC( pDC );
}
else {
AfxMessageBox("check the - ShownImage - image", MB_OK, NULL);
};
}
/////////////////////////////////////////////////////////////////////////////
// CSDI_projectView printing
BOOL CSDI_projectView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CSDI_projectView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CSDI_projectView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CSDI_projectView diagnostics
#ifdef _DEBUG
void CSDI_projectView::AssertValid() const
{
CView::AssertValid();
}
void CSDI_projectView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CSDI_projectDoc* CSDI_projectView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSDI_projectDoc)));
return (CSDI_projectDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSDI_projectView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -