DataGridViewLinkCell.UseColumnTextForLinkValue 屬性

定義

取得或設定值,指出資料行 Text 屬性值是否會顯示為連結文字。

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

屬性值

如果資料行 Text 屬性值會顯示為連結文字,則為 true;如果儲存格 FormattedValue 屬性值會顯示為連結文字,則為 false。 預設為 false

範例

下列程式碼範例示範屬性的使用 DataGridViewLinkColumn.UseColumnTextForLinkValue 方式,這與這個屬性類似。 此範例是類別概觀主題中較大範例的 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

備註

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

適用於

另請參閱