Share via


DataGridViewButtonColumn.UseColumnTextForButtonValue Özellik

Tanım

Özellik değerinin bu sütundaki Text hücreler için düğme metni olarak görüntülenip görüntülenmeyeceğini belirten bir değer alır veya ayarlar.

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

Özellik Değeri

true özellik değeri sütundaki Text düğmelerde görüntüleniyorsa; false her hücrenin FormattedValue özellik değeri kendi düğmesinde görüntüleniyorsa. Varsayılan değer: false.

Özel durumlar

özelliğinin CellTemplate değeri şeklindedir null.

Örnekler

Aşağıdaki kod örneği bu özelliğin kullanımını gösterir.

private void CreateUnboundButtonColumn()
{
    // Initialize the button column.
    DataGridViewButtonColumn buttonColumn =
        new DataGridViewButtonColumn();
    buttonColumn.Name = "Details";
    buttonColumn.HeaderText = "Details";
    buttonColumn.Text = "View Details";

    // Use the Text property for the button text for all cells rather
    // than using each cell's value as the text for its own button.
    buttonColumn.UseColumnTextForButtonValue = true;

    // Add the button column to the control.
    dataGridView1.Columns.Insert(0, buttonColumn);
}
Private Sub CreateUnboundButtonColumn()

    ' Initialize the button column.
    Dim buttonColumn As New DataGridViewButtonColumn

    With buttonColumn
        .HeaderText = "Details"
        .Name = "Details"
        .Text = "View Details"

        ' Use the Text property for the button text for all cells rather
        ' than using each cell's value as the text for its own button.
        .UseColumnTextForButtonValue = True
    End With

    ' Add the button column to the control.
    dataGridView1.Columns.Insert(0, buttonColumn)

End Sub

Açıklamalar

Varsayılan olarak, DataGridViewCell.FormattedValue düğme hücresinin değeri düğmedeki metin olarak görüntülenir. UseColumnTextForButtonValue özelliği, her hücre için düğme metnini ayarlamanıza veya tüm düğme hücreleri için özellik değerini kullanmanıza Text olanak tanır.

Bu özelliği almak veya ayarlamak, özelliği tarafından CellTemplate döndürülen nesnenin özelliğini alır veya ayarlarUseColumnTextForButtonValue. Bu özelliğin ayarlanması, sütundaki UseColumnTextForButtonValue her hücrenin özelliğini de ayarlar ve sütun görünümünü yeniler. Tek tek hücreler için belirtilen değeri geçersiz kılmak için, sütun değerini ayarladıktan sonra hücre değerlerini ayarlayın.

Şunlara uygulanır

Ayrıca bkz.