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

📄 scanviewerview.h

📁 看图软件
💻 H
字号:
// ScanViewerView.h : CScanViewerView 类的接口
//


#pragma once
#include "afxcoll.h"


#define BLANK_TOP          0          //顶部空白10像素	
#define BLANK_BOTTOM       0          //底部空白10像素	
#define BLANK_LEFT         0          //左部空白10像素	
#define BLANK_RIGHT        0          //右部空白10像素	


using namespace Gdiplus;

class CScanViewerView : public CScrollView
{
protected: // 仅从序列化创建
	CScanViewerView();
	DECLARE_DYNCREATE(CScanViewerView)

// 属性
public:
	CScanViewerDoc* GetDocument() const;

// 操作
public:

// 重写
	public:
	virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual void OnInitialUpdate(); // 构造后第一次调用
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);

// 实现
public:
	virtual ~CScanViewerView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// 生成的消息映射函数
protected:
	DECLARE_MESSAGE_MAP()


private:
	//用于标识视口的大小
	typedef enum
	{
		FULL_SIZE,                     //实际大小
		EQUAL_SIZE,                    //合适大小
		EQUAL_WIDTH,                   //合适宽度
		EQUAL_HEIGHT                   //合适高度
	} enViewSize;
	enum enPhotoPosition
	{
		LEFT_UP,
		LEFT_CENTER,
		LEFT_DOWN,
		CENTER_UP,
		CENTER_CENTER,
		CENTER_DOWN,
		RIGHT_UP,
		RIGHT_CENTER,
		RIGHT_DOWN
	};

	typedef enum
	{
		CLOCKWISE_ROTATE_0,                     //顺时针方向旋转0度
		CLOCKWISE_ROTATE_90,                    //顺时针方向旋转90度
		CLOCKWISE_ROTATE_180,                   //顺时针方向旋转180度
		CLOCKWISE_ROTATE_270                    //顺时针方向旋转270度
	} enClockwiseRotate;

private:	
	CImage     imgShow;		                                            
	enPhotoPosition   m_enImgS;
	enViewSize m_enViewSize;                                               //用于存储显示风格	
	enClockwiseRotate m_enClockwiseRotate;                                 //用于存储旋转风格	
	COLORREF   m_BkColor;                                                  //用于改变背色
	POINT m_ptLBStartPos;                                                  //用于鼠标拖动图片(存储位置)
	BOOL  m_bDragPhotoState;                                               //用于鼠标拖动图片(存储状态)	
	CStringArray m_strPhotoFileArray;	                                   //用于存放图片文件数组
	CString m_strUpwardsImgPath;                                           //用于上一目录的第一张图片
	CString m_strNextImgPath;                                              //用于下一目录的第一张图片
	CString m_strThreadFindFirstPhoto;									   //用于在多线程中传递值,在找到的第一张图片时应用	
	UINT    m_nThreadCustomRoll;	                                       //用于在多线程中传递值,在图片滚动时应用	
	
protected:
	virtual void OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/);

public:
	afx_msg void OnNavPapednimg();
	afx_msg void OnNavPapeupimg();
	afx_msg void OnNavHomeimg();
	afx_msg void OnNavEndimg();
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);	
	afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnSetbkcolor();
	afx_msg void OnUpdateFullsize(CCmdUI *pCmdUI);
	afx_msg void OnUpdateEqualsize(CCmdUI *pCmdUI);
	afx_msg void OnUpdateEqualwidth(CCmdUI *pCmdUI);
	afx_msg void OnUpdateEqualheight(CCmdUI *pCmdUI);
	afx_msg void OnFullsize();
	afx_msg void OnEqualsize();
	afx_msg void OnEqualwidth();
	afx_msg void OnEqualheight();
	afx_msg void OnMagnify();
	afx_msg void OnReduce();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg LRESULT MSGUpdateMyView(WPARAM wParam, LPARAM lParam);	               //用户自定义消息函数,打开图片,更新视图
	afx_msg LRESULT MSGOpenFirstPhoto(WPARAM wParam, LPARAM lParam);	           //用户要定义一个用户消息,用于搜索图片目录

public:        //设置顺时针方向旋转多少度	
	afx_msg void OnClockwiseRotate0();
	afx_msg void OnClockwiseRotate90();
	afx_msg void OnClockwiseRotate180();
	afx_msg void OnClockwiseRotate270();
	afx_msg void OnUpdateClockwiseRotate0(CCmdUI *pCmdUI);
	afx_msg void OnUpdateClockwiseRotate90(CCmdUI *pCmdUI);
	afx_msg void OnUpdateClockwiseRotate180(CCmdUI *pCmdUI);
	afx_msg void OnUpdateClockwiseRotate270(CCmdUI *pCmdUI);

public:		
	static UINT ThreadFindAllPhoto(LPVOID param);
	static UINT ThreadCustomRoll(LPVOID param);	
	// 多线程遍历目录,返回所有找到的第一张图片,param为字符串指针(为返回值)
	static UINT ThreadFindFirstPhoto(LPVOID param);
	void BuildImage(LPCTSTR pszFileName);		
	void PhotoRange(CStringArray& strPathArray);
	void PhotoNumberRange(CStringArray& strPathArray);	
	CString GetPhotoFileTitle(CString strFullPathName);
	//遍历该目录
	void SearchFolder();
};

#ifndef _DEBUG  // ScanViewerView.cpp 的调试版本
inline CScanViewerDoc* CScanViewerView::GetDocument() const
   { return reinterpret_cast<CScanViewerDoc*>(m_pDocument); }
#endif

⌨️ 快捷键说明

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