DataGridViewCell.GetInheritedStyle(DataGridViewCellStyle, Int32, Boolean) 方法

定义

获取应用于单元格的样式。Gets the style applied to the cell.

public:
 virtual System::Windows::Forms::DataGridViewCellStyle ^ GetInheritedStyle(System::Windows::Forms::DataGridViewCellStyle ^ inheritedCellStyle, int rowIndex, bool includeColors);
public virtual System.Windows.Forms.DataGridViewCellStyle GetInheritedStyle (System.Windows.Forms.DataGridViewCellStyle inheritedCellStyle, int rowIndex, bool includeColors);
abstract member GetInheritedStyle : System.Windows.Forms.DataGridViewCellStyle * int * bool -> System.Windows.Forms.DataGridViewCellStyle
override this.GetInheritedStyle : System.Windows.Forms.DataGridViewCellStyle * int * bool -> System.Windows.Forms.DataGridViewCellStyle
Public Overridable Function GetInheritedStyle (inheritedCellStyle As DataGridViewCellStyle, rowIndex As Integer, includeColors As Boolean) As DataGridViewCellStyle

参数

inheritedCellStyle
DataGridViewCellStyle

将使用继承的单元格样式填充的 DataGridViewCellStyleA DataGridViewCellStyle to be populated with the inherited cell style.

rowIndex
Int32

该单元格的父行索引。The index of the cell's parent row.

includeColors
Boolean

如果在返回的单元格样式中包括继承的颜色,则为 true;否则为 falsetrue to include inherited colors in the returned cell style; otherwise, false.

返回

DataGridViewCellStyle

一个 DataGridViewCellStyle,它包括从单元格的父行、父列和父 DataGridView 继承而来的单元格样式设置。A DataGridViewCellStyle that includes the style settings of the cell inherited from the cell's parent row, column, and DataGridView.

例外

该单元格无关联的 DataGridViewThe cell has no associated DataGridView.

-或--or- ColumnIndex 小于 0,这表示该单元格为行标头单元格。ColumnIndex is less than 0, indicating that the cell is a row header cell.

rowIndex 小于 0,或大于等于父 DataGridView 中的行数。rowIndex is less than 0, or greater than or equal to the number of rows in the parent DataGridView.

注解

此方法返回一个 DataGridViewCellStyle ,它从 DataGridViewCellStyle 单元格的父行、列和的对象中继承其设置 DataGridViewThis method returns a DataGridViewCellStyle that inherits its settings from the DataGridViewCellStyle objects of the cell's parent row, column, and DataGridView. 有关详细信息,请参阅 Windows 窗体 DataGridView 控件中的单元格样式For more information, see Cell Styles in the Windows Forms DataGridView Control.

适用于

另请参阅