📄 myimageltview.cpp
字号:
// MyImageLtView.cpp : implementation of the CMyImageLtView class
//
#include "stdafx.h"
#include "MyImageLt.h"
#include "MyImageLtDoc.h"
#include "MyImageLtView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyImageLtView
IMPLEMENT_DYNCREATE(CMyImageLtView, CView)
BEGIN_MESSAGE_MAP(CMyImageLtView, CView)
//{{AFX_MSG_MAP(CMyImageLtView)
// 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
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyImageLtView construction/destruction
CMyImageLtView::CMyImageLtView()
{
// TODO: add construction code here
m_ImageLt.Create(IDB_BITIMAGE,32,1,RGB(255,255,255)); // 创建一个图像列表
CBitmap bmpAdd;
bmpAdd.LoadBitmap(IDB_BITMAP1); // 装载位图资源
m_ImageLt.Add(&bmpAdd,RGB(255,255,255)); // 将位图加入到图像列表中
bmpAdd.DeleteObject(); // 释放位图
HICON hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME); // 获得应用程序图标的句柄
m_ImageLt.Add(hIcon); // 将图标加入到图像列表中
}
CMyImageLtView::~CMyImageLtView()
{
}
BOOL CMyImageLtView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMyImageLtView drawing
void CMyImageLtView::OnDraw(CDC* pDC)
{
CMyImageLtDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CPoint ptImage(10,10); // 显示位图的坐标
for(int nImageNum=0; nImageNum<6; nImageNum++)
{
m_ImageLt.Draw(pDC,nImageNum,ptImage,ILD_NORMAL); // 显示6幅位图
ptImage.x+=50;
}
}
/////////////////////////////////////////////////////////////////////////////
// CMyImageLtView diagnostics
#ifdef _DEBUG
void CMyImageLtView::AssertValid() const
{
CView::AssertValid();
}
void CMyImageLtView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMyImageLtDoc* CMyImageLtView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMyImageLtDoc)));
return (CMyImageLtDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMyImageLtView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -