//LogCtrl.h
|
#ifndef __LOGCTRL_H
|
#define __LOGCTRL_H
|
#define __LOGCTRL_LIB_H
|
|
#ifndef __AFXTEMPL_H
|
#include <afxtempl.h>
|
#endif
|
|
//LOG CELL STATE
|
//MERGE
|
#define LCS_NORML 0x0000
|
#define LCS_MERGE 0x0001
|
#define LCS_UNUSE 0x0002
|
|
//LINE
|
#define LCS_TLINE 0x0001 //TOP LINE DRAW
|
#define LCS_BLINE 0x0002 //BOTTOM LINE DRAW
|
#define LCS_LLINE 0x0004 //LEFT LINE DRAW
|
#define LCS_RLINE 0x0008 //RIGHT LINE DRAW
|
#define LCS_RECT LCS_TLINE|LCS_BLINE|LCS_LLINE|LCS_RLINE
|
|
//merge state
|
#define SetFlag(n) DWORD(BYTE(n)<<16)
|
#define GetFlag(d) int((d & 0x00FF0000)>>16)
|
|
#define SetDown(n) DWORD(BYTE(n)<<8)
|
#define GetDown(d) int((d & 0x0000FF00)>>8)
|
|
#define SetRight(n) DWORD(BYTE(n))
|
#define GetRight(d) int((d & 0x000000FF))
|
|
#define LOGCHECK(b) if(b){return;}
|
#define LOGCHECK0(b) if(b){return 0;}
|
#define LOGCHECK1(b) if(b){return -1;}
|
|
class CPrintDC;
|
class CLogCell;
|
class CLogPage;
|
class CLogCtrl;
|
|
typedef CArray<CLogCell,CLogCell&> CLogItem;
|
typedef CArray<CLogItem,CLogItem&> CLogItemArray;
|
typedef CArray<CLogPage,CLogPage&> CLogPageArray;
|
|
typedef struct tagLOGCELL
|
{
|
BYTE m_nLine; //惑窍谅快 扼牢
|
UINT m_nState;//促弗伎苞 捍钦灯绰瘤 ..
|
UINT m_nFormat;//沥纺葛靛
|
RECT m_rect; //伎狼 康开
|
COLORREF m_txtclr;//臂磊祸
|
COLORREF m_bkgclr;//硅版祸
|
CString m_strTxt;//臂磊
|
CFont* m_pfont; //迄飘
|
CBitmap* m_pBitmap;//厚飘甘
|
}LOGCELL;
|
|
//Orientation=啊肺(1), 技肺(2) bDialog=DoModal()
|
class CPrintDC
|
{
|
public:
|
CPrintDC();
|
virtual ~CPrintDC();
|
CDC* GetPrintDC(int Orientation, BOOL bDialog=FALSE);
|
protected:
|
CDC *m_pDC;
|
};
|
|
class CLogCell : public tagLOGCELL
|
{
|
public:
|
CLogCell();
|
CLogCell(LPCSTR lpstr,
|
CRect rect,
|
int nFormat=DT_CENTER,
|
COLORREF textColor=0x00000000,
|
COLORREF backColor=0x00ffffff,
|
CFont* pf=NULL);
|
|
void operator=(const CLogCell& log);
|
void InitCell();
|
void Draw(CDC* pDC);
|
};
|
|
class CLogPage
|
{
|
public:
|
CLogPage();
|
CLogPage(CPoint startPnt);
|
virtual ~CLogPage();
|
void RemoveAll();
|
void operator=(CLogPage& page);
|
|
//青,凯 肮荐甫 汲沥茄促.
|
void SetColCount(int nCount);
|
void SetRowCount(int nCount);
|
BOOL RemoveRow(int nRow);
|
|
//厘钎 免仿困摹
|
void SetStartPoint(CPoint startPnt);
|
CPoint GetStartPoint() const;
|
|
//青,凯 肮荐甫 府畔茄促.
|
int GetColCount() const;
|
int GetRowCount() const;
|
|
//气,臭捞甫 汲沥茄促.
|
BOOL SetColWidth(int nCol, int nWidth);
|
BOOL SetRowHeight(int nRow, int nHeight);
|
|
//迄飘甫 汲沥茄促.
|
BOOL SetCellFont(int nRow, int nCol, CFont* pf);
|
BOOL SetCellFont(int nsRow, int nsCol, int neRow, int neCol, CFont* pf);
|
CFont* GetCellFont(int nRow, int nCol);
|
|
//硅版祸阑 汲沥茄促.
|
BOOL SetCellBkgColor(int nRow, int nCol, COLORREF color);
|
COLORREF GetCellBkgColor(int nRow, int nCol);
|
|
//臂磊祸阑 汲沥茄促.
|
BOOL SetCellTxtColor(int nRow, int nCol, COLORREF color);
|
COLORREF GetCellTxtColor(int nRow, int nCol);
|
|
//臂磊困摹 汲沥
|
BOOL SetCellFormat(int nRow, int nCol, int nFormat);
|
int GetCellFormat(int nRow, int nCol);
|
|
//Rect阑 汲沥茄促.
|
BOOL SetCellRect(int nRow, int nCol, CRect rect);
|
BOOL GetCellRect(int nRow, int nCol, CRect& rect);
|
|
//BITMAP阑 汲沥茄促.
|
BOOL SetCellBmp(int nRow, int nCol, CBitmap* pBmp);
|
CBitmap* GetCellBmp(int nRow, int nCol);
|
|
//荤阿屈 弊副锭 绢蠢 困摹甫 弊副 巴牢啊 汲沥茄促.
|
BOOL SetCellLine(int nRow, int nCol, int nState=LCS_RECT/*LCS_RECT*/);
|
int GetCellLine(int nRow, int nCol);
|
|
//伎俊 臂磊阑 涝仿茄促.
|
BOOL SetItemText(int nRow, int nCol, LPCTSTR lpstr, int nFormat=DT_CENTER|DT_VCENTER|DT_SINGLELINE);
|
CString GetItemText(int nRow, int nCol);
|
|
BOOL SetCell(int nRow, int nCol, CLogCell lc);
|
CLogCell* GetCell(int nRow, int nCol);
|
|
//伎阑 捍钦茄促.
|
BOOL CellMerge(int nsCol, int nsRow, int neCol ,int neRow );
|
|
//免仿茄促.(nPageNO绰 其捞瘤 锅龋捞哥 0老 版快 免仿登瘤 臼绰促.)
|
void Draw(CDC* pDC, int nPageNO=0);
|
|
//SetPageRect(,)窃荐甫 荤侩矫
|
//Draw(CDC* pDC, int nPageNO=0);窃荐甫 龋免窍扁 官肺傈俊 荤侩秦具窃
|
//侩档:
|
// <<page>> <<device>>
|
// 0 100 0 1000
|
// ΓΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΔ ΓΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΔ
|
// Β (10,10) (90,10)Β Β (100,100) (900,100)Β
|
// Β ΓΑΑΑΑΑΑΑΑΑΑΑΔ Β Β ΓΑΑΑΑΑΑΑΑΑΑΑΔ Β
|
// Β Β Β Β Β Β Β Β
|
// Β Β Β ΜΜΜΜΜΜΜ>Β Β Β
|
// Β Β Β Β Β Β Β Β
|
// Β Β Β Β Β Β Β Β
|
// Β ΖΑΑΑΑΑΑΑΑΑΑΑΕ Β Β ΖΑΑΑΑΑΑΑΑΑΑΑΕ Β
|
// Β (10,40) (90,40)Β Β (100,400) (900,400)Β
|
// Β Β Β Β
|
// Β Β Β Β
|
// Β Β Β Β
|
// Β Β Β Β
|
// Β Β Β Β
|
// Β Β Β Β
|
// Β Β Β Β
|
// Β Β Β Β
|
// Β Β Β Β
|
// Β Β Β Β
|
// Β Β Β Β
|
// ΖΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΕ ΖΑΑΑΑΑΑΑΑΑΑΑΑΑΑΑΕ
|
// 200 100,200 2000 1000,2000
|
//
|
// CRect page(0,0,100,200);
|
// CRect device(0,0,1000,2000);
|
// 咯归阑 炼陛 林妨搁: CRect device(100,100,900,1900);
|
// SetPageRect(pDC, page, device);
|
BOOL SetPageRect(CDC* pDC, CRect page, CRect device);
|
protected:
|
bool m_IsViewPort;
|
int m_RowCnt;
|
int m_ColCnt;
|
CPoint m_startPnt;
|
CLogItemArray m_liAry;
|
};
|
|
//厘钎 傈眉甫 包府茄促.
|
//厘钎甫 免仿窍扁 困秦 怖 鞘夸窍柳 臼促.
|
//CLogPage甫 荤侩秦档 公规窍促.
|
class CLogCtrl
|
{
|
public:
|
CLogCtrl();
|
virtual ~CLogCtrl();
|
int GetLogPageCount();
|
void AddLogPage(CLogPage& lp);
|
CLogPage* GetLogPage(int nPage);
|
void DelLogPage(int nPage);
|
void Draw(CDC* pDC, DOCINFO* pDocInfo);
|
protected:
|
CLogPageArray m_log;
|
};
|
|
#endif
|