📄 scaletoviewview.cpp
字号:
// ScaleToViewView.cpp : implementation of the CScaleToViewView class
//
#include "stdafx.h"
#include "ScaleToView.h"
#include "ScaleToViewDoc.h"
#include "ScaleToViewView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CScaleToViewView
IMPLEMENT_DYNCREATE(CScaleToViewView, CView)
BEGIN_MESSAGE_MAP(CScaleToViewView, CView)
//{{AFX_MSG_MAP(CScaleToViewView)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CScaleToViewView construction/destruction
CScaleToViewView::CScaleToViewView()
{
m_Image.Load( "File.bmp" );
}
CScaleToViewView::~CScaleToViewView()
{
}
BOOL CScaleToViewView::PreCreateWindow(CREATESTRUCT& cs)
{
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CScaleToViewView drawing
void CScaleToViewView::OnDraw(CDC* pDC)
{
CScaleToViewDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// We assume we're in MM_TEXT mapping mode.
RECT Rect;
GetClientRect( &Rect );
// Make a copy of the image.
CImageObject Image;
Image = m_Image;
// Scale the temporary image.
Image.Stretch( Rect.right, Rect.bottom );
// Set the palette and draw.
if( GetFocus() == this )
Image.SetPalette( pDC );
Image.Draw( pDC );
}
/////////////////////////////////////////////////////////////////////////////
// CScaleToViewView diagnostics
#ifdef _DEBUG
void CScaleToViewView::AssertValid() const
{
CView::AssertValid();
}
void CScaleToViewView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CScaleToViewDoc* CScaleToViewView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CScaleToViewDoc)));
return (CScaleToViewDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CScaleToViewView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -