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

📄 gridctrl.h

📁 一个完整的数字硬盘录像机系统软件
💻 H
📖 第 1 页 / 共 2 页
字号:
/////////////////////////////////////////////////////////////////////////////
// GridCtrl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
#ifndef _GRIDCTRL_H_
#define _GRIDCTRL_H_
#include "CellRange.h"
#define GRIDCTRL_CLASSNAME _T("MFCGridCtrl")

#define IsSHIFTpressed() ( (GetKeyState(VK_SHIFT) & (1 << (sizeof(SHORT)*8-1))) != 0   )
#define IsCTRLpressed()  ( (GetKeyState(VK_CONTROL) & (1 << (sizeof(SHORT)*8-1))) != 0 )
//////////////////////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////////////////////
#include "GridCell.h"
///////////////////////////////////////////////////////////////////////////////////
//
///////////////////////////////////////////////////////////////////////////////////
class CGridCtrl;
void AFXAPI DDX_GridControl(CDataExchange* pDX, int nIDC, CGridCtrl& rControl);
/////////////////////////////////////////////////////////////////////////////
// CGridCtrl window
/////////////////////////////////////////////////////////////////////////////
class CGridCtrl : public CWnd
{
// Construction
public:
    CGridCtrl(int nRows = 0, int nCols = 0, int nFixedRows = 0, int nFixedCols = 0);
    DECLARE_DYNCREATE(CGridCtrl)
// Operations
public:
    BOOL            Create(const RECT& rect, CWnd* parent, UINT nID,
                                 DWORD dwStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE);
	void            CreateTooltips();
    BOOL            SubclassWindow(HWND hWnd);
    int             GetRowCount() const;
    int             GetColumnCount() const;
    int             GetFixedRowCount() const;
    int             GetFixedColumnCount() const;
    BOOL            SetRowCount(int nRows = 10);
    BOOL            SetColumnCount(int nCols = 10);
    BOOL            SetFixedRowCount(int nFixedRows = 1);
    BOOL            SetFixedColumnCount(int nFixedCols = 1);

    int             GetRowHeight(int nRow) const;
    BOOL            SetRowHeight(int row, int height);
    int             GetColumnWidth(int nCol) const;
    BOOL            SetColumnWidth(int col, int width);

    BOOL            GetCellOrigin(int nRow, int nCol, LPPOINT p) const;
    BOOL            GetCellOrigin(const CCellID& cell, LPPOINT p) const;
    BOOL            GetCellRect(int nRow, int nCol, LPRECT pRect) const;
    BOOL            GetCellRect(const CCellID& cell, LPRECT pRect) const;
    CCellID         SetFocusCell(int nRow, int nCol);
    CCellID         SetFocusCell(CCellID cell);

    int             GetFixedRowHeight() const;
    int             GetFixedColumnWidth() const;
    long            GetVirtualWidth() const;
    long            GetVirtualHeight() const;
    void            SetTextColor(COLORREF clr);
    COLORREF        GetTextColor() const;
    void            SetTextBkColor(COLORREF clr);
    COLORREF        GetTextBkColor() const;
    void            SetBkColor(COLORREF clr);
    COLORREF        GetBkColor() const;
    void            SetFixedTextColor(COLORREF clr);
    COLORREF        GetFixedTextColor() const;
    void            SetFixedBkColor(COLORREF clr);
    COLORREF        GetFixedBkColor() const;
    void            SetGridColor(COLORREF clr);
    COLORREF        GetGridColor() const;
    int             GetSelectedCount() const;
    CCellID         GetFocusCell() const; 
    void            SetImageList(CImageList* pList);
    CImageList*     GetImageList() const;
    void            SetGridLines(int nWhichLines = GVL_BOTH);
    int             GetGridLines() const;
    void            SetEditable(BOOL bEditable = TRUE);
    BOOL            IsEditable() const;
    void            SetModified(BOOL bModified = TRUE);
    BOOL            GetModified() const;
    void            SetListMode(BOOL bEnableListMode = TRUE);
    BOOL            GetListMode() const;
    void            EnableSelection(BOOL bEnable = TRUE);
    BOOL            IsSelectable() const;
    void            EnableDragAndDrop(BOOL bAllow = TRUE);
    BOOL            GetDragAndDrop() const;
    void            SetRowResize(BOOL bResize = TRUE);
    BOOL            GetRowResize() const;
    void            SetColumnResize(BOOL bResize = TRUE);
    BOOL            GetColumnResize() const;
    void            SetHeaderSort(BOOL bSortOnClick = TRUE);
    BOOL            GetHeaderSort() const;
    void            SetHandleTabKey(BOOL bHandleTab = TRUE);
    BOOL            GetHandleTabKey() const;
    void            SetDoubleBuffering(BOOL bBuffer = TRUE);
    BOOL            GetDoubleBuffering() const;
    void            EnableTitleTips(BOOL bEnable = TRUE);
    BOOL            GetTitleTips();
    BOOL            SetItem(const GV_ITEM* pItem);
    BOOL            GetItem(GV_ITEM* pItem);
    BOOL            SetItemText(int nRow, int nCol, LPCTSTR str);
    virtual CString GetItemText(int nRow, int nCol);
    BOOL            SetItemData(int nRow, int nCol, LPARAM lParam);
    LPARAM          GetItemData(int nRow, int nCol) const;
    BOOL            SetItemImage(int nRow, int nCol, int iImage);
    int             GetItemImage(int nRow, int nCol) const;
    BOOL            SetItemState(int nRow, int nCol, UINT state);
    UINT            GetItemState(int nRow, int nCol) const;
    BOOL            SetItemFormat(int nRow, int nCol, UINT nFormat);
    UINT            GetItemFormat(int nRow, int nCol) const;
	BOOL            SetItemBkColour(int nRow, int nCol, COLORREF cr = CLR_DEFAULT);
	COLORREF        GetItemBkColour(int nRow, int nCol) const;
	BOOL            SetItemFgColour(int nRow, int nCol, COLORREF cr = CLR_DEFAULT);
	COLORREF        GetItemFgColour(int nRow, int nCol) const;
	BOOL            SetItemFont(int nRow, int nCol, LOGFONT* lf);
	LOGFONT*        GetItemFont(int nRow, int nCol) const;
    int             InsertColumn(LPCTSTR strHeading, UINT nFormat = DT_LEFT,int nColumn = -1,UINT nEditFormat=0);
    int             InsertRow(LPCTSTR strHeading, int nRow = -1);
    BOOL            DeleteColumn(int nColumn);
    BOOL            DeleteRow(int nRow);
    BOOL            DeleteNonFixedRows();
    BOOL            DeleteAllItems();
    BOOL            AutoSizeRow(int nRow);
    BOOL            AutoSizeColumn(int nCol);
    void            AutoSizeRows();
    void            AutoSizeColumns();
    void            AutoSize();
    void            ExpandColumnsToFit();
    void            ExpandRowsToFit();
    void            ExpandToFit();
    CSize           GetTextExtent(LPCTSTR str, BOOL bUseSelectedFont = TRUE);
    void            EnsureVisible(CCellID &cell);
    void            EnsureVisible(int nRow, int nCol);
    BOOL            IsCellVisible(int nRow, int nCol) const;
    BOOL            IsCellVisible(CCellID cell) const;
    BOOL            IsCellEditable(int nRow, int nCol) const;
    BOOL            IsCellEditable(CCellID &cell) const;
    void            SetRedraw(BOOL bAllowDraw, BOOL bResetScrollBars = FALSE);
    BOOL            RedrawCell(int nRow, int nCol, CDC* pDC = NULL);
    BOOL            RedrawCell(const CCellID& cell, CDC* pDC = NULL);
    BOOL            RedrawRow(int row);
    BOOL            RedrawColumn(int col);
    void            Print(); 
    BOOL            Save(LPCTSTR filename);
    BOOL            Load(LPCTSTR filename);
    CCellRange      GetCellRange() const;
    CCellRange      GetSelectedCellRange() const;
    void            SetSelectedRange(const CCellRange& Range, BOOL bForceRepaint = FALSE);
    void            SetSelectedRange(int nMinRow, int nMinCol, int nMaxRow, int nMaxCol,                   BOOL bForceRepaint = FALSE);
    BOOL            IsValid(int nRow, int nCol) const;
    BOOL            IsValid(const CCellID& cell) const;
    BOOL            IsValid(const CCellRange& range) const;
    CCellID         GetNextItem(CCellID& cell, int nFlags) const;
    BOOL            SortTextItems(int nCol, BOOL bAscending);
    BOOL            SortItems(PFNLVCOMPARE pfnCompare, int nCol, BOOL bAscending, LPARAM data = 0);
// Overrides
    // ClassWizard generated virtual function overrides

⌨️ 快捷键说明

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