DataGridViewLinkCell 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示包含链接的单元格。
public ref class DataGridViewLinkCell : System::Windows::Forms::DataGridViewCell
public class DataGridViewLinkCell : System.Windows.Forms.DataGridViewCell
type DataGridViewLinkCell = class
inherit DataGridViewCell
Public Class DataGridViewLinkCell
Inherits DataGridViewCell
- 继承
示例
下面的代码示例演示如何使用 DataGridViewCell 作为 的 DataGridViewColumn模板。 对列中的任何单元格所做的样式更改会影响列的所有单元格。 此代码示例是为 DataGridViewColumn 类提供的一个更大示例的一部分。
void CustomizeCellsInThirdColumn()
{
int thirdColumn = 2;
DataGridViewColumn^ column = dataGridView->Columns[ thirdColumn ];
DataGridViewCell^ cell = gcnew DataGridViewTextBoxCell;
cell->Style->BackColor = Color::Wheat;
column->CellTemplate = cell;
}
private void CustomizeCellsInThirdColumn()
{
int thirdColumn = 2;
DataGridViewColumn column =
dataGridView.Columns[thirdColumn];
DataGridViewCell cell = new DataGridViewTextBoxCell();
cell.Style.BackColor = Color.Wheat;
column.CellTemplate = cell;
}
Private Sub CustomizeCellsInThirdColumn()
Dim thirdColumn As Integer = 2
Dim column As DataGridViewColumn = _
dataGridView.Columns(thirdColumn)
Dim cell As DataGridViewCell = _
New DataGridViewTextBoxCell()
cell.Style.BackColor = Color.Wheat
column.CellTemplate = cell
End Sub
注解
类 DataGridViewLinkCell 是用于显示链接的专用类型 DataGridViewCell 。
DataGridViewLinkColumn是专用于保存此类型的单元格的列类型。 默认情况下, DataGridViewLinkColumn.CellTemplate 初始化为新的 DataGridViewLinkCell。 若要在现有 DataGridViewLinkCell之后对列中的单元格进行图案化,请将列的 CellTemplate 属性设置为要用作模式的单元格。
列的单元格相关属性是模板单元格中类似名称的属性的包装器。 更改模板单元格的属性值将仅影响基于更改后添加的模板的单元格。 但是,更改列的单元格相关属性值将更新模板单元格和列中的所有其他单元格,并在必要时刷新列显示。
继承者说明
从 DataGridViewLinkCell 派生类并将新属性添加到派生类时,请务必重写 Clone() 方法,以在克隆操作期间复制新属性。 还应调用基类的 Clone() 方法,以便将基类的属性复制到新单元格。
构造函数
| DataGridViewLinkCell() |
初始化 DataGridViewLinkCell 类的新实例。 |
属性
| AccessibilityObject |
获取分配给 DataGridViewCell.DataGridViewCellAccessibleObject 的 DataGridViewCell。 (继承自 DataGridViewCell) |
| ActiveLinkColor |
获取或设置用来显示活动链接的颜色。 |
| ColumnIndex |
获取此单元格的列索引。 (继承自 DataGridViewCell) |
| ContentBounds |
获取环绕单元格内容区域的边框。 (继承自 DataGridViewCell) |
| ContextMenuStrip |
获取或设置与单元格关联的快捷菜单。 (继承自 DataGridViewCell) |
| DataGridView |
获取与此元素关联的 DataGridView 控件。 (继承自 DataGridViewElement) |
| DefaultNewRowValue |
获取新记录所在行中单元格的默认值。 (继承自 DataGridViewCell) |
| Displayed |
获取一个值,该值指示当前该单元格是否显示在屏幕上。 (继承自 DataGridViewCell) |
| EditedFormattedValue |
获取该单元格的当前格式化值,而不考虑该单元格是否处于编辑模式,也不论是否尚未提交此值。 (继承自 DataGridViewCell) |
| EditType |
获取单元格的寄宿编辑控件的类型。 |
| ErrorIconBounds |
获取单元格的错误图标的界限。 (继承自 DataGridViewCell) |
| ErrorText |
获取或设置描述与该单元格关联的错误条件的文本。 (继承自 DataGridViewCell) |
| FormattedValue |
获取为显示进行格式化的单元格的值。 (继承自 DataGridViewCell) |
| FormattedValueType |
获取单元格值的显示 Type。 |
| Frozen |
获取指示单元格是否已被冻结的值。 (继承自 DataGridViewCell) |
| HasStyle |
获取指示是否已设置 Style 属性的值。 (继承自 DataGridViewCell) |
| InheritedState |
获取该单元格从它的行和列的状态继承后的当前状态。 (继承自 DataGridViewCell) |
| InheritedStyle |
获取当前应用于单元格的样式。 (继承自 DataGridViewCell) |
| IsInEditMode |
获取一个值,该值指示此单元格当前是否处于编辑状态。 (继承自 DataGridViewCell) |
| LinkBehavior |
获取或设置一个值,该值表示链接的行为。 |
| LinkColor |
获取或设置用来显示不活动和未访问链接的颜色。 |
| LinkVisited |
获取或设置一个值,该值指示是否访问过此链接。 |
| OwningColumn |
获取包含此单元格的列。 (继承自 DataGridViewCell) |
| OwningRow |
获取包含此单元格的行。 (继承自 DataGridViewCell) |
| PreferredSize |
获取适合该单元格的矩形区域的大小(以像素为单位)。 (继承自 DataGridViewCell) |
| ReadOnly |
获取或设置一个值,该值表示是否可以编辑该单元格的数据。 (继承自 DataGridViewCell) |
| Resizable |
获取一个值,该值指示是否可以调整单元格的大小。 (继承自 DataGridViewCell) |
| RowIndex |
获取单元格父行的索引。 (继承自 DataGridViewCell) |
| Selected |
获取或设置一个值,该值指示是否已选定该单元格。 (继承自 DataGridViewCell) |
| Size |
获取单元格的大小。 (继承自 DataGridViewCell) |
| State |
获取元素的用户界面 (UI) 状态。 (继承自 DataGridViewElement) |
| Style |
获取或设置单元格的样式。 (继承自 DataGridViewCell) |
| Tag |
获取或设置包含有关单元格补充数据的对象。 (继承自 DataGridViewCell) |
| ToolTipText |
获取或设置与此单元格关联的 ToolTip 文本。 (继承自 DataGridViewCell) |
| TrackVisitedState |
获取或设置一个值,该值指示链接被访问后,其颜色是否改变。 |
| UseColumnTextForLinkValue |
获取或设置一个值,该值指示列 Text 属性值是否显示为链接文本。 |
| Value |
获取或设置与此单元格关联的值。 (继承自 DataGridViewCell) |
| ValueType |
获取或设置单元格中值的数据类型。 |
| Visible |
获取一个值,该值指示单元格是否位于已隐藏的行或列中。 (继承自 DataGridViewCell) |
| VisitedLinkColor |
获取或设置用于显示以前访问过的链接的颜色。 |