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

📄 imageviewerdlg.h

📁 在wince下面开发的一个图片浏览器全部用图形界面编写的,带图片放大缩小,图片拖动,图片自动播放等功能,支持jpg,bmp格式. 图片缩放始终保持原始比例,
💻 H
字号:
// ImageViewerDlg.h : header file
//
extern "C" {
#include "../JpegLib/jpeglib.h"
}
#include "ByteArray.h"
#include "STScreenBuffer.h"
#include "DIBSectionCE.h"

#if !defined(AFX_IMAGEVIEWERDLG_H__0F141971_BB5D_431E_9B78_CB5A6CDFEEAC__INCLUDED_)
#define AFX_IMAGEVIEWERDLG_H__0F141971_BB5D_431E_9B78_CB5A6CDFEEAC__INCLUDED_

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

#define IMG_UNKNOWN	0xFFFFFFFF
#define IMG_BMP		0
#define IMG_JPG		1
#define MAX_ZOOM	4	// 2^3  =8

/////////////////////////////////////////////////////////////////////////////
// CImageViewerDlg dialog
typedef struct InitInfmation			
{
	int	     FileviewPosition;
	int 	     FileListSize;
	int	     CurrentFileNO;
	CString   SourceFile;		//上次打开的文件及目录
	//CStringArray FileList;
	 
} RunInit;


class CImageViewerDlg : public CDialog
{
private:
	bool		m_InitDC;
	HBITMAP m_hBitmap;		
	CDIBSectionCE m_DIBSection;
	CRect	m_DefaultRect;		//图片窗口位置常数  非全屏时 
	CSize	m_ImageSize;		//图片大小
	CPoint	m_CenterPt;			//图像视中心点
	CPoint	m_DownPt;			//记录鼠标按下点用于图片拖动
	int		m_Zoom;			//比例编号  0--3 表示 1--8倍
	float		m_Scale;			//象素缩放比例

	int		m_SrcWidth;			//资源位置 用于 StretchBlt
	int		m_SrcHeight;
	int		m_SrcStartX;
	int		m_SrcStartY;
	
	int		m_DstWidth;			//目标位置用于StretchBlt
	int		m_DstHeight;
	int		m_DstStartX;
	int		m_DstStartY;
	
	int		m_FileNumber;
	int		m_DelayTime;

	bool		m_bFullScreen;
	bool		m_bAutoPlay;
	bool		m_bReDraw;
	CString 	m_SourceFile;    		//文件名及路径
	CString 	m_TitleText;

	CDC		m_BgDC;
	//CDC		m_MemDC;

	RunInit	m_InitInf;
// Construction
public:
	CRect 	GetZoomRect(CRect* rcScreen,CSize sizePicture);    //没有调用
	CString 	GetFileName(CString strFileName);
	void 	ShowControl(BOOL bShow);
	void 	ZoomImage(int iZoom);
	void  Zoom2FullScreen(void);	
	int	GetImageType(CString strFileName);
	bool 	LoadImage(CString strFileName);
	HBITMAP LoadImageJPG(const CString &strFileName);
	CImageViewerDlg(CWnd* pParent = NULL);	// standard constructor
	~CImageViewerDlg();
// Dialog Data
	//{{AFX_DATA(CImageViewerDlg)
	enum { IDD = IDD_IMAGEVIEWER_DIALOG };
	CBmpButton	m_butZoomOut;
	CBmpButton	m_butOpen;
	CBmpButton	m_butZoomIn;
	CBmpButton	m_butNext;
	CBmpButton	m_butFullScreen;
	CBmpButton	m_butClose;
	CBmpButton	m_butBack;
	CBmpButton	m_butAutoPlay;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CImageViewerDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CImageViewerDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnButtonAutoplay();
	afx_msg void OnButtonBack();
	afx_msg void OnButtonClose();
	afx_msg void OnButtonFullscreen();
	afx_msg void OnButtonNext();
	afx_msg void OnButtonOpen();
	afx_msg void OnButtonZoomin();
	afx_msg void OnButtonZoomout();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_IMAGEVIEWERDLG_H__0F141971_BB5D_431E_9B78_CB5A6CDFEEAC__INCLUDED_)

⌨️ 快捷键说明

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