📄 dblistview.h
字号:
#if !defined(AFX_DBFILELISTVIEW_H__41107A71_C9D4_4A71_8046_B76887C69DBD__INCLUDED_)
#define AFX_DBFILELISTVIEW_H__41107A71_C9D4_4A71_8046_B76887C69DBD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DBFileListView.h : header file
//
#include "..\DBFILE\DBFileExt.h"
#include "DHListBind.h"
/////////////////////////////////////////////////////////////////////////////
// CDBListView view
#define RECORD_BEGIN_TIME clock_t time1,time2;\
double time = 0;\
time1 = clock();
#define RECORD_END_TIME time2 = clock();\
time = (double)(time2 - time1) / CLOCKS_PER_SEC;
#define LOG_PAST_TIME(string) TRACE("%s:%f seconds\n",string,time);\
time1 = time2;
//排序字符串和在文件中的偏移量
//排序字符串和在文件中的偏移量
typedef struct
{
char strSort[256];
int nOldIndex;
}TagPosInFile;
class CDBListView : public CListView
{
protected:
CDBListView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CDBListView)
// Attributes
public:
// Implementation
public:
BOOL ReflashList(CString strCmd ="");
//得到每一项的列数
int GetColNum();
//得到当前共有多少项
int GetSizeList();
//外部中断标志设置
void SetBreakFlag(BOOL bFlag);
//文件的状态是否被打开
BOOL IsFileOpen();
//设置一页的大小
void SetPageSize(int nPageSize);
//得到当前显示的页码
int GetCurPage();
//得到总页数
int GetTotalPage();
//得到一页的项目数
int GetPageSize();
//显示前一页
int DisplayPrevPage();
//显示下一页
int DisplayNextPage();
//显示第一页
int DisplayFirstPage();
void SetFileName(char *fn){ m_fileSource.SetFilePath(fn);}
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDBListView)
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CDBListView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
//按第nCol列设置排序数组
void SetArraySort(int nCol);
//初始化排序数组
void InitArraySort();
//关闭文件
int CloseFile();
//打开文件
int OpenFile();
//重新设置属性
void Reset();
//在末尾插入一列,item字符以串"|"断开
int AddItem(char* item,int line,int pos);
//定义表头,item字符串以"|"断开
int AddHead(char* item);
//显示当前页,如果中断返回FALSE
BOOL DisplayCurPage();
//{{AFX_MSG(CListSortExt)
//}}AFX_MSG
// Generated message map functions
protected:
//{{AFX_MSG(CDBListView)
afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnShowNextPage();
afx_msg void OnShowPrevPage();
afx_msg void OnTableOpenFile();
afx_msg void OnTableOpenSave();
afx_msg void OnShowStartPage();
afx_msg void OnShowEndPage();
//}}AFX_MSG
//被显示的源文件
CDBFileExt m_fileSource;
//文件状态
BOOL m_bIsFileOpen;
//顺序,0为反排序,1为正排序
BOOL m_flagOrder;
//共有项目数
int m_sizeList;
//每一项的列数
int m_sizeCol;
//每页的大小
int m_sizePage;
//共有页数
int m_totalPage;
//当前页码
int m_pageNum;
//排序数组
TagPosInFile* m_arraySort;
//上一次的列号
int m_lastCol;
//记录曾经点击过的序号
int *m_pRecord;
//是否被外部中断(文件形成过程中中断,TRUE不可用,FALSE可用)
CDHListBind m_ListBind;
BOOL m_bBreakFlag;
bool m_bOpenFile;
CString m_strFileName;
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DBFILELISTVIEW_H__41107A71_C9D4_4A71_8046_B76887C69DBD__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -