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

📄 gridctrl.shtml

📁 MFC 打印效果 超好的学习例子
💻 SHTML
📖 第 1 页 / 共 4 页
字号:
</TD><TD WIDTH="50%">Gets the bounding rectangle for the given cell, returning
TRUE if successful. (cell must be visible for success).
See also <a href="gridctrl.shtml#CCellID">CCellID<a>.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetTextRect(int nRow, int nCol, LPRECT pRect)t</FONT></PRE>
</TD><TD WIDTH="50%">Gets the bounding rectangle for the text in the given cell, returning
TRUE if successful. (cell must be visible for success).</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetTextRect(const CCellID&amp; cell, LPRECT pRect)</FONT></PRE>
</TD><TD WIDTH="50%">Gets the bounding rectangle for the text in the given cell, returning
TRUE if successful. (cell must be visible for success).
See also <a href="gridctrl.shtml#CCellID">CCellID<a>.</TD>
</TR>

</TABLE>

<h3><a name="Appearance">General appearance and features</a></h3>

<TABLE CELLSPACING=0 WIDTH="90%">

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetImageList(CImageList* pList)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the current image list for the grid. The control only
takes a copy of the pointer to the image list, not a copy of the list itself.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">CImageList* GetImageList()</FONT></PRE>
</TD><TD WIDTH="50%">Gets the current image list for the grid.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetGridLines(int nWhichLines = GVL_BOTH)</FONT></PRE>
</TD><TD WIDTH="50%">Sets which (if any) gridlines are displayed. 
See <a href="gridctrl.shtml#GVL_Values">here</a> for possible values.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">int GetGridLines() </FONT></PRE>
</TD><TD WIDTH="50%">Gets which (if any) gridlines are displayed.
See <a href="gridctrl.shtml#GVL_Values">here</a> for possible return values.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetEditable(BOOL bEditable = TRUE)</FONT></PRE>
</TD><TD WIDTH="50%">Sets if the geid is editable.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL IsEditable()</FONT></PRE>
</TD><TD WIDTH="50%">Gets whether or not the grid is editable.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetModified(BOOL bModified = TRUE, 
                 int nRow = -1, int nCol = -1)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the modified flag for a cell. If no row or columns is
specified, then change affects the entire grid.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetModified(int nRow = -1, int nCol = -1)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the modified flag for a cell, or if no cell, it returns
the status for the entire grid.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetListMode(BOOL bEnableListMode = TRUE)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the grid into (or out of) List mode. When the grid is in list mode,
full row selection is enabled and clicking on the column header will sort the grid by rows.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetListMode()</FONT></PRE>
</TD><TD WIDTH="50%">Get whether or not the grid is in list mode.</TD>
</TR>

 <TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetSingleRowSelection(BOOL bSing = TRUE)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the grid into (or out of) Single row selection mode. This mode
is only effective when in ListMode. When in this mode, only a single row at a time can
be selected, so the grid behaves somewhat like a multicolumn listbox.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetSingleRowSelection()</FONT></PRE>
</TD><TD WIDTH="50%">Get whether or not the grid is in single row selection mode.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void EnableSelection(BOOL bEnable = TRUE)</FONT></PRE>
</TD><TD WIDTH="50%">Sets whether or not the grid cells can be selected.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL IsSelectable()</FONT></PRE>
</TD><TD WIDTH="50%">Get whether or not grid cells are selectable.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void EnableDragAndDrop(BOOL bAllow = TRUE)</FONT></PRE>
</TD><TD WIDTH="50%">Sets whether drag and drop is enabled.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetDragAndDrop()</FONT></PRE>
</TD><TD WIDTH="50%">Get whether drag and drop is allowed.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetRowResize(BOOL bResize = TRUE) </FONT></PRE>
</TD><TD WIDTH="50%">Sets whether or not rows can be resized.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetRowResize()</FONT></PRE>
</TD><TD WIDTH="50%">Gets whether or not rows can be resized.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetColumnResize(BOOL bResize = TRUE)</FONT></PRE>
</TD><TD WIDTH="50%">Sets whether or not columns can be resized.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetColumnResize()</FONT></PRE>
</TD><TD WIDTH="50%">Gets whether or not columns can be resized.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetHeaderSort(BOOL bSortOnClick = TRUE)</FONT></PRE>
</TD><TD WIDTH="50%">Sets whether or not rows are sorted on column header clicks in ListMode.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetHeaderSort()</FONT></PRE>
</TD><TD WIDTH="50%">Gets whether or not rows are sorted on column header clicks in ListMode.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetHandleTabKey(BOOL bHandleTab = TRUE)</FONT></PRE>
</TD><TD WIDTH="50%">Sets whether or not the TAB key is used to move the cell selection.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetHandleTabKey()</FONT></PRE>
</TD><TD WIDTH="50%">Gets whether or not the TAB key is used to move the cell selection.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetDoubleBuffering(BOOL bBuffer = TRUE)</FONT></PRE>
</TD><TD WIDTH="50%">Sets whether or not double buffering is used when painting (avoids flicker).</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetDoubleBuffering()</FONT></PRE>
</TD><TD WIDTH="50%">Gets whether or not double buffering is used when painting.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void EnsureVisible(CCellID &cell)</FONT></PRE>
</TD><TD WIDTH="50%">Ensures that the specified cell is visible.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL IsCellVisible(CCellID &cell) const<br>
BOOL IsCellVisible(CCellID cell) const</FONT></PRE>
</TD><TD WIDTH="50%">Returns TRUE if the cell is visible.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL IsCellEditable(CCellID &cell) const<br>
BOOL IsCellEditable(CCellID cell) const</FONT></PRE>
</TD><TD WIDTH="50%">Returns TRUE if the cell is editable.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void EnsureVisible(int nRow, int nCol)</FONT></PRE>
</TD><TD WIDTH="50%">Ensures that the specified cell is visible.</TD>
</TR>

 <TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void EnableTitleTips(BOOL bEnable = TRUE)</FONT></PRE>
</TD><TD WIDTH="50%">Sets whether or not titletips are used.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetTitleTips()</FONT></PRE>
</TD><TD WIDTH="50%">Gets whether or not titletips are used.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL IsCellFixed(int nRow, int nCol)</FONT></PRE>
</TD><TD WIDTH="50%">Returns TRUE if the given cell is a fixed cell.</TD>
</TR>

</table>

<h3><a name="Colours">Colours</a></h3>

<TABLE CELLSPACING=0 WIDTH="90%">

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetTextColor(COLORREF clr)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the colour of the text in non-fixed cells.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">COLORREF GetTextColor()</FONT></PRE>
</TD><TD WIDTH="50%">Gets the colour of the text in non-fixed cells.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetTextBkColor(COLORREF clr)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the background colour of the non-fixed cells.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">COLORREF GetTextBkColor() </FONT></PRE>
</TD><TD WIDTH="50%">Gets the background colour of the non-fixed cells.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetFixedTextColor(COLORREF clr)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the colour of the text in fixed cells.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">COLORREF GetFixedTextColor()</FONT></PRE>
</TD><TD WIDTH="50%">Gets the colour of the text in fixed cells.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetFixedBkColor(COLORREF clr)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the background colour of the fixed cells.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">COLORREF GetFixedBkColor() </FONT></PRE>
</TD><TD WIDTH="50%">Gets the background colour of the fixed cells.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetBkColor(COLORREF clr)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the background colour of the control 
(the area outside fixed and non-fixed cells).</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">COLORREF GetBkColor() </FONT></PRE>
</TD><TD WIDTH="50%">Gets the background colour of the control.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">void SetGridColor(COLORREF clr)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the colour of the gridlines.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">COLORREF GetGridColor() </FONT></PRE>
</TD><TD WIDTH="50%">Gets the colour of the grid lines.</TD>
</TR>

</Table>

<p>See also the <a href="gridctrl.shtml#CellColours">Individual Cell colour
functions</a> that allow an individual cell's colours to be changes seperate
to the rest of the grid.

<h3><a name="CellInfo">General cell information</a></h3>

<TABLE CELLSPACING=0 WIDTH="90%">

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">int GetSelectedCount()</FONT></PRE>
</TD><TD WIDTH="50%">Gets the number of selected cells.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">CCellID GetFocusCell()</FONT></PRE>
</TD><TD WIDTH="50%">Gets the cell with the focus.
See also <a href="gridctrl.shtml#CCellID">CCellID<a>.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL SetItem(const GV_ITEM* pItem)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the contents of a cell with the values from the 
<a href="gridctrl.shtml#GV_ITEM">GV_ITEM</a> structure. Note that the value
of the mask field will determine which values are actually changed 
(cf. CListCtrl::SetItem).
</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL GetItem(GV_ITEM* pItem)</FONT></PRE>
</TD><TD WIDTH="50%">Fills the <a href="gridctrl.shtml#GV_ITEM">GV_ITEM</a>
structure with values from the specified cell. Note that the value of the 
mask field will determine which values are actually retrieved 
(cf. CListCtrl::GetItem). </TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL SetItemText(int nRow, int nCol, LPCTSTR str)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the text for the given cell. Returns TRUE on success</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">virtual CString GetItemText(int nRow, int nCol)</FONT></PRE>
</TD><TD WIDTH="50%">Gets the text for the given cell. This function is virtual
in order to aid extensibility. No more messing around with LVN_GETDISPINFO messages or
string pooling!</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL SetItemData(int nRow, int nCol, LPARAM lParam)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the lParam (user-defined data) field for the given cell. 
Returns TRUE on success. See also <a href="gridctrl.shtml#GV_ITEM">GV_ITEM</a>.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">LPARAM GetItemData(int nRow, int nCol) const</FONT></PRE>
</TD><TD WIDTH="50%">Gets the lParam (user-defined data) field for the given cell.
See also <a href="gridctrl.shtml#GV_ITEM">GV_ITEM</a>.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">BOOL SetItemImage(int nRow, int nCol, int iImage)</FONT></PRE>
</TD><TD WIDTH="50%">Sets the image index for the given cell. Returns TRUE on success.
See also <a href="gridctrl.shtml#GV_ITEM">GV_ITEM</a>.</TD>
</TR>

<TR VALIGN=TOP><TD WIDTH="50%">
<PRE><FONT COLOR="#990000">int GetItemImage(int nRow, int nCol) const</FONT></PRE>
</TD><TD WIDTH="50%">Gets the image index for the given cell.</TD>

⌨️ 快捷键说明

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