DataGridViewLinkCell.TrackVisitedState 屬性

定義

取得或設定值,指出當瀏覽連結時,它的顏色是否會改變。

public:
 property bool TrackVisitedState { bool get(); void set(bool value); };
public bool TrackVisitedState { get; set; }
member this.TrackVisitedState : bool with get, set
Public Property TrackVisitedState As Boolean

屬性值

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

備註

當 為 時 falseLinkVisited 屬性將不會在流覽時自動設定為 true

TrackVisitedState設定擁有資料行的 屬性也會設定 TrackVisitedState 資料行中每個儲存格的 屬性,並重新整理資料行顯示。 若要覆寫個別儲存格的指定值,請在設定資料行值之後設定儲存格值。

適用於

另請參閱