Share via


DataGridViewButtonCell.UseColumnTextForButtonValue Vlastnost

Definice

Získá nebo nastaví hodnotu určující, zda se text vlastnícího sloupce zobrazí na tlačítku zobrazeném buňkou.

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

Hodnota vlastnosti

true pokud hodnota Value vlastnosti bude automaticky odpovídat hodnotě Text vlastnosti vlastního sloupce; v opačném případě false. Výchozí formát je false.

Příklady

Následující příklad kódu ukazuje použití tohoto člena.

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

Poznámky

Buňka FormattedValue tlačítka se zobrazí jako text na tlačítku. Vlastnost UseColumnTextForButtonValue umožňuje buď nastavit text tlačítka pro každou buňku, nebo použít Text hodnotu vlastnosti nadřazeného sloupce pro všechny buňky tlačítka.

UseColumnTextForButtonValue Nastavení vlastnosti vlastního sloupce také nastaví UseColumnTextForButtonValue vlastnost každé buňky ve sloupci a aktualizuje zobrazení sloupce. Pokud chcete přepsat zadanou hodnotu pro jednotlivé buňky, nastavte hodnoty buněk po nastavení hodnoty sloupce.

Platí pro

Viz také