⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ebookbrowview.cpp

📁 电子相册程序,实现图片的浏览,放大缩小等动能!evc4.0下编译通过!
💻 CPP
字号:
// eBookBrowView.cpp : implementation of the CEBookBrowView class
//

#include "stdafx.h"
#include "eBookBrow.h"

#include "eBookBrowDoc.h"
#include "eBookBrowView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


#define PIC_PANE_TOP    80
#define PIC_PANE_LEFT   150
#define BT_SIZE          26
#define BK_CORLOR       RGB(255, 255, 255)
/////////////////////////////////////////////////////////////////////////////
// CEBookBrowView

IMPLEMENT_DYNCREATE(CEBookBrowView, CView)

BEGIN_MESSAGE_MAP(CEBookBrowView, CView)
	//{{AFX_MSG_MAP(CEBookBrowView)
	ON_BN_CLICKED(IDB_BT2, OnBTNext)
	ON_BN_CLICKED(IDB_BT1, OnBTPrev)
	ON_COMMAND(ID_MENUITEM32771, OnMenuitem32771)
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CEBookBrowView construction/destruction

CEBookBrowView::CEBookBrowView()
{
	// TODO: add construction code here

}

CEBookBrowView::~CEBookBrowView()
{
}

BOOL CEBookBrowView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CEBookBrowView drawing

void CEBookBrowView::OnDraw(CDC* pDC)
{
	CEBookBrowDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CEBookBrowView printing

BOOL CEBookBrowView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CEBookBrowView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CEBookBrowView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CEBookBrowView diagnostics

#ifdef _DEBUG
void CEBookBrowView::AssertValid() const
{
	CView::AssertValid();
}

void CEBookBrowView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CEBookBrowDoc* CEBookBrowView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEBookBrowDoc)));
	return (CEBookBrowDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CEBookBrowView message handlers

void CEBookBrowView::OnInitialUpdate() 
{
	CView::OnInitialUpdate();
	AfxGetMainWnd()->GetClientRect(&m_clientRect);
	// TODO: Add your specialized code here and/or call the base class
	m_picWnd.Create(WS_VISIBLE|WS_CHILD, CRect(CPoint(PIC_PANE_LEFT,PIC_PANE_TOP + 20),CSize(m_clientRect.Width() - 2*PIC_PANE_LEFT, m_clientRect.Height() - 2*PIC_PANE_TOP)), this, IDC_WND1);
	m_TextWnd.Create(WS_VISIBLE|WS_CHILD, CRect(CPoint(PIC_PANE_LEFT + 80,PIC_PANE_TOP - 20),CSize(m_clientRect.Width() - 2*(PIC_PANE_LEFT + 80), 40)), this, IDC_WND2);

	CRect btRect1(CPoint(PIC_PANE_LEFT + 30, PIC_PANE_TOP - 20), CSize(BT_SIZE, BT_SIZE));
	m_BTNext.Create(_T(""), WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, btRect1, this, IDB_BT1);
	m_BTNext.SetFont(GetFont());
    m_BTNext.SetIcon(IDI_ICON2);
	m_BTNext.SetFlat();
	m_BTNext.SetTooltipText(_T("上一页"));
	m_BTNext.SetColor(CButtonST::BTNST_COLOR_BK_OUT, BK_CORLOR);
	m_BTNext.SetColor(CButtonST::BTNST_COLOR_BK_IN, BK_CORLOR);
	m_BTNext.SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, BK_CORLOR);
    
	CRect btRect2(CPoint(btRect1.right + m_clientRect.Width() - 2*PIC_PANE_LEFT - 2*BT_SIZE - 60, PIC_PANE_TOP - 20), CSize(BT_SIZE, BT_SIZE));
	m_BTPrev.Create(_T(""), WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, btRect2, this, IDB_BT2);
	m_BTPrev.SetFont(GetFont());
    m_BTPrev.SetIcon(IDI_ICON1);
	m_BTPrev.SetFlat();
	m_BTPrev.SetTooltipText(_T("下一页"));
	m_BTPrev.SetColor(CButtonST::BTNST_COLOR_BK_OUT, BK_CORLOR);
	m_BTPrev.SetColor(CButtonST::BTNST_COLOR_BK_IN, BK_CORLOR);
	m_BTPrev.SetColor(CButtonST::BTNST_COLOR_BK_FOCUS, BK_CORLOR);
}


void CEBookBrowView::OnBTNext()
{
     m_picWnd.NextPage(m_TextWnd);
}

void CEBookBrowView::OnBTPrev()
{
	 m_picWnd.PrevPage(m_TextWnd);
}

void CEBookBrowView::OnMenuitem32771() 
{
	// TODO: Add your command handler code here
	m_picWnd.LoadPothoBook(m_TextWnd);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -