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

定义

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

public:
 override System::Windows::Forms::DataGridViewCellStyle ^ GetInheritedStyle(System::Windows::Forms::DataGridViewCellStyle ^ inheritedCellStyle, int rowIndex, bool includeColors);
public override System.Windows.Forms.DataGridViewCellStyle GetInheritedStyle (System.Windows.Forms.DataGridViewCellStyle inheritedCellStyle, int rowIndex, bool includeColors);
override this.GetInheritedStyle : System.Windows.Forms.DataGridViewCellStyle * int * bool -> System.Windows.Forms.DataGridViewCellStyle
Public Overrides 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.

例外

rowIndex 不是 -1。rowIndex is not -1.

注解

此方法返回一个 DataGridViewCellStyle ,它从的 DataGridViewCellStyle 和属性返回的对象中继承其设置 ColumnHeadersDefaultCellStyle DefaultCellStyle DataGridViewThis method returns a DataGridViewCellStyle that inherits its settings from the DataGridViewCellStyle objects returned by the ColumnHeadersDefaultCellStyle and DefaultCellStyle properties of the DataGridView. 有关详细信息,请参阅 Windows 窗体 DataGridView 控件中的单元格样式For more information, see Cell Styles in the Windows Forms DataGridView Control.

适用于

另请参阅