DataGridViewLinkColumn::LinkColor Property
.NET Framework (current version)
Gets or sets the color used to display an unselected link within cells in the column.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
| Exception | Condition |
|---|---|
| InvalidOperationException | The value of the CellTemplate property is null. |
Getting or setting this property gets or sets the LinkColor property of the object returned by the CellTemplate property. Setting this property also sets the LinkColor property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value.
The following code example initializes this property to blue. This example is part of a larger example available in the DataGridViewComboBoxColumn class overview topic.
private: void AddLinkColumn() { DataGridViewLinkColumn^ links = gcnew DataGridViewLinkColumn(); links->UseColumnTextForLinkValue = true; links->HeaderText = ColumnName::ReportsTo.ToString(); links->DataPropertyName = ColumnName::ReportsTo.ToString(); links->ActiveLinkColor = Color::White; links->LinkBehavior = LinkBehavior::SystemDefault; links->LinkColor = Color::Blue; links->TrackVisitedState = true; links->VisitedLinkColor = Color::YellowGreen; DataGridView1->Columns->Add(links); }
.NET Framework
Available since 2.0
Available since 2.0
Show: