DataGridViewLinkCell.LinkColor 屬性

定義

取得或設定用來顯示非現用或未瀏覽的連結之色彩。Gets or sets the color used to display an inactive and unvisited link.

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

屬性值

Color,表示最初顯示連結所用的色彩。A Color that represents the color used to initially display a link. 預設值為使用者在 Internet Explorer 中對連結色彩的設定。The default value is the user's Internet Explorer setting for the link color.

範例

下列程式碼範例示範DataGridViewLinkColumn.LinkColor屬性的用法, 這類似于此屬性。The following code example demonstrates the use of the DataGridViewLinkColumn.LinkColor property, which is similar to this property. 這個範例是 [ DataGridViewComboBoxColumn類別總覽] 主題中提供之較大範例的一部分。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

備註

設定 [擁有] 資料行的LinkColor 屬性也會設定資料行中每個資料格的屬性,並重新整理資料行顯示。LinkColorSetting the LinkColor property of the owning column 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.

適用於

另請參閱