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

📄 imageviewwnd.h

📁 Under CE4.2 view bitmap with shrink and magnify
💻 H
字号:
//////////////////////////////////////////////////////////////////////////
//ImageViewWnd.h
#ifndef _IMAGEVIEWWND_H
#define _IMAGEVIEWWND_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "MemDC.h"
#include "XButton.h"
#include "TranslucentWnd.h"

class CImageViewWnd:public CWnd
{
//construction
public:
	CImageViewWnd();

//view Mode 0: Location Mode 1: Picture Mode
public:
	typedef enum {
		Location_mode = 0,
		Picture_mode =1,
	} ImageViewMode;
	ImageViewMode m_mode;
	void SetViewMode(ImageViewMode mode);
	ImageViewMode GetViewMode();
	
	//buttons shown in Picture Mode.
	CXButton m_xbtnMenu;
	CXButton m_xbtnSatellite;
	CXButton m_xbtnInfo;

//Attribute
public:
    CMemDC       m_memDC;         //DC for displaying current image
	CMemDC       m_memSrcDC;      //DC to Store original image
//    CXButton     m_xbtnMagnify;   //Button to magnify image
//    CXButton     m_xbtnShrink;    //Button to shrink  image
    CXButton     m_xbtnQuit;      //Button to Quit Application
 
	CTranslucentWnd m_trsWndMagnify;
	CTranslucentWnd m_trsWndShrink;

    //Image information for zoom and drag image
    int m_ncxImageWidth,          //Width  of Image 
		m_ncyImageHeight,         //Height of Image
		m_nxImageBegin,           //Left   of Image          
		m_nyImageBegin;           //Top    of Image

    int m_nxSrcBegin,             //Left   of Source DC
		m_nySrcBegin,             //Top    of Source DC
		m_ncxSrcWidth,            //Width  of Source DC (240)
		m_ncySrcHeight;           //Height of Source DC (320)

	//move
	BOOL   m_bMoveFlag;           //Flag of Dragging Image
	CPoint m_ptStartMove;
	int    m_nxImgMove;
	int    m_nyImgMove;
	int    m_nxAbsoluteImgMove;
	int    m_nyAbsoluteImgMove;
	
	//zoom scale
	double m_dZoomScale;
	double m_dZoomScaleStep;

// Operations
public:
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTransferSelectWnd)
//	public:
//	virtual BOOL PreTranslateMessage(MSG* pMsg);
	//}}AFX_VIRTUAL

// Implementation
public:
	void    UpdateMemDC();
	void    DragImage(int ncxOffset, int ncyOffset);
	virtual ~CImageViewWnd();

    void OnBtnMagnify();
    void OnBtnShrink();
	// Generated message map functions
protected:
	//{{AFX_MSG(CTransferSelectWnd)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnPaint();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	//}}AFX_MSG
//	afx_msg void OnBtnMagnify();
//	afx_msg void OnBtnShrink();
	afx_msg void OnBtnMenu();
	afx_msg void OnBtnSatellite();
	afx_msg void OnBtnInfo();
	afx_msg void OnBtnQuit();	
//	afx_msg LRESULT OnTranslucent(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()	
};

#endif //#ifndef _IMAGEVIEWWND_H

⌨️ 快捷键说明

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