DataGridViewLinkColumn.VisitedLinkColor Property

Definition

Gets or sets the color used to display a link that has been previously visited.

public:
 property System::Drawing::Color VisitedLinkColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
public System.Drawing.Color VisitedLinkColor { get; set; }
member this.VisitedLinkColor : System.Drawing.Color with get, set
Public Property VisitedLinkColor As Color

Property Value

A Color that represents the color used to display a link that has been visited. The default value is the user's Internet Explorer setting for the visited link color.

Exceptions

The value of the CellTemplate property is null.

Examples

The following code example initializes this property so that the link is yellow-green if the user has visited it. 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);
    }
private void AddLinkColumn()
{
    DataGridViewLinkColumn links = new 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);
}
Private Sub AddLinkColumn()

    Dim links As New DataGridViewLinkColumn()
    With links
        .UseColumnTextForLinkValue = True
        .HeaderText = ColumnName.ReportsTo.ToString()
        .DataPropertyName = ColumnName.ReportsTo.ToString()
        .ActiveLinkColor = Color.White
        .LinkBehavior = LinkBehavior.SystemDefault
        .LinkColor = Color.Blue
        .TrackVisitedState = True
        .VisitedLinkColor = Color.YellowGreen
    End With
    DataGridView1.Columns.Add(links)
End Sub

Remarks

If the TrackVisitedState property is set to false, the VisitedLinkColor property is ignored.

Getting or setting this property gets or sets the VisitedLinkColor property of the object returned by the CellTemplate property. Setting this property also sets the VisitedLinkColor 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.

Applies to

See also