📄 calibrateview.cpp
字号:
// CALIBRATEView.cpp : implementation of the CCALIBRATEView class
//
#include "stdafx.h"
#include "CALIBRATE.h"
#include "MAINCAL.h"
#include "CALIBRATEDoc.h"
#include "CALIBRATEView.h"
#include "CalInit.h"
extern CCalInit* m_pCalInit;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCALIBRATEView
BOOL flag ; //控制主刻度菜单的状态
IMPLEMENT_DYNCREATE(CCALIBRATEView, CView)
BEGIN_MESSAGE_MAP(CCALIBRATEView, CView)
//{{AFX_MSG_MAP(CCALIBRATEView)
ON_WM_LBUTTONDOWN()
ON_COMMAND(ID_CAL_INIT, OnCalInit)
ON_COMMAND(ID_MAIN_CAL, OnMainCal)
ON_UPDATE_COMMAND_UI(ID_MAIN_CAL, OnUpdateMainCal)
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CCALIBRATEView construction/destruction
CCALIBRATEView::CCALIBRATEView()
{
// TODO: add construction code here
}
CCALIBRATEView::~CCALIBRATEView()
{
}
BOOL CCALIBRATEView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCALIBRATEView drawing
CSize CCALIBRATEView::GetBitmapSize(const CBitmap &bitmap) //获取加载位图的尺寸
{
BITMAP stBitmap;
bitmap.GetObject(sizeof(BITMAP),&stBitmap);
return CSize(stBitmap.bmWidth,stBitmap.bmHeight);
}
void CCALIBRATEView::OnDraw(CDC* pDC)
{
CCALIBRATEDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rectTile;
CDC dcMem;
CBitmap bmBackground;
bmBackground.LoadBitmap(IDB_BITMAP1);
CSize sizeBg = GetBitmapSize(bmBackground);
dcMem.CreateCompatibleDC(pDC);
CBitmap *pbmOld=dcMem.SelectObject(&bmBackground);
GetClientRect(&rectTile);
pDC->StretchBlt(0,0,rectTile.right,rectTile.bottom,
&dcMem,0,0,sizeBg.cx,sizeBg.cy,SRCCOPY);
//Copies a bitmap from a source rectangle into a destination rectangle, stretching
// or compressing the bitmap if necessary to fit the dimensions of the destination rectangle.
dcMem.SelectObject(pbmOld);
dcMem.DeleteDC();
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CCALIBRATEView printing
BOOL CCALIBRATEView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CCALIBRATEView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CCALIBRATEView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CCALIBRATEView diagnostics
#ifdef _DEBUG
void CCALIBRATEView::AssertValid() const
{
CView::AssertValid();
}
void CCALIBRATEView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCALIBRATEDoc* CCALIBRATEView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCALIBRATEDoc)));
return (CCALIBRATEDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCALIBRATEView message handlers
void CCALIBRATEView::OnLButtonDown(UINT nFlags, CPoint point)
{
CView::OnLButtonDown(nFlags, point);
}
void CCALIBRATEView::OnCalInit()
{
m_pCalInit = new CCalInit;
m_pCalInit->DoModal();
delete m_pCalInit;
}
void CCALIBRATEView::OnMainCal()
{
MAINCAL dlg;
dlg.DoModal();
flag = false;
}
void CCALIBRATEView::OnUpdateMainCal(CCmdUI* pCmdUI)
{
pCmdUI->Enable(flag) ;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -