📄 rowview.h
字号:
// rowview.h : interface of the CRowView class
//
// This class implements the behavior of a scrolling view that
// presents multiple rows of fixed-height data. A row view is
// similar to an owner-draw list box in its visual behavior; but
// unlike a list box, a row view has all the benefits of a
// view (as well as a scroll view), including--perhaps most
// important--printing and print preview.
///////////////////////////////////////////////////////////////
class CRowView : public CScrollView // abstract base class
{
DECLARE_DYNAMIC(CRowView)
// Construction/destruction
protected:
CRowView();
virtual ~CRowView();
// Attributes
protected:
int m_nRowWidth; // width of row in
// logical units
int m_nRowHeight; // height of row in
// logical units
int m_nCharWidth; // avg character width in
// logical units
int m_nPrevSelectedRow; // index of most recently
// selected row
int m_nPrevRowCount; // most recent row count,
// before update
int m_nRowsPerPrintedPage; // how many rows fit on a
// printed page
// Operations-Attributes
protected:
virtual void UpdateRow(int nInvalidRow); // called by derived
// class OnUpdate
virtual void CalculateRowMetrics(CDC* pDC)
{ GetRowWidthHeight(pDC, m_nRowWidth, m_nRowHeight,
m_nCharWidth); }
virtual void UpdateScrollSizes();
virtual CRect RowToWndRect(CDC* pDC, int nRow);
virtual int RowToYPos(int nRow);
virtual void RectLPtoRowRange(const CRect& rectLP,
int& nFirstRow, int& nLastRow,
BOOL bIncludePartiallyShownRows);
virtual int LastViewableRow();
// Overridables
protected:
virtual void GetRowWidthHeight(CDC* pDC, int& nRowWidth,
int& nRowHeight,
int& nCharWidth) = 0;
virtual int GetActiveRow() = 0;
virtual int GetRowCount() = 0;
virtual void OnDrawRow(CDC* pDC, int nRow, int y,
BOOL bSelected) = 0;
virtual void ChangeSelectionNextRow(BOOL bNext) = 0;
virtual void ChangeSelectionToRow(int nRow) = 0;
// Implementation
protected:
// standard overrides of MFC classes
virtual void OnInitialUpdate();
virtual void OnDraw(CDC* pDC); // overridden to draw
// this view
virtual void OnPrepareDC(CDC* pDC,
CPrintInfo* pInfo = NULL);
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
// Generated message map functions
protected:
//{{AFX_MSG(CRowView)
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt,
UINT nFlags);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -