DataGridViewLinkCell.TrackVisitedState 属性       
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示链接被访问后,其颜色是否改变。
public:
 property bool TrackVisitedState { bool get(); void set(bool value); };public bool TrackVisitedState { get; set; }member this.TrackVisitedState : bool with get, setPublic Property TrackVisitedState As Boolean属性值
如果在选中链接时,该链接更改颜色,则为 true;否则为 false。 默认值为 true。
示例
下面的代码示例演示了该属性的使用 DataGridViewLinkColumn.TrackVisitedState ,该属性类似于此属性。 此示例是类概述主题中提供的大型示例的 DataGridViewComboBoxColumn 一部分。
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
注解
何时 false, LinkVisited 该属性不会在访问时自动设置为 true 该属性。
TrackVisitedState设置拥有列的属性还会设置TrackVisitedState列中每个单元格的属性并刷新列显示。 若要替代单个单元格的指定值,请设置列值后设置单元格值。