DataGridViewButtonCell.UseColumnTextForButtonValue プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
所有側の列のテキストが、セル内のボタンに表示されるかどうかを示す値を取得または設定します。
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
プロパティ値
Value プロパティの値が、所有側の列の Text プロパティの値に自動的に設定される場合は true
。それ以外の場合は false
。 既定値は、false
です。
例
次のコード例では、このメンバーの使用方法を示します。
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
注釈
ボタン セルの は FormattedValue 、ボタンにテキストとして表示されます。 UseColumnTextForButtonValueプロパティを使用すると、各セルのボタン テキストを設定したり、すべてのボタン セルにText親列のプロパティ値を使用したりできます。
UseColumnTextForButtonValue所有する列の プロパティを設定すると、列内のすべてのセルのプロパティも設定UseColumnTextForButtonValueされ、列の表示が更新されます。 個々のセルに対して指定した値をオーバーライドするには、列の値を設定した後にセル値を設定します。
適用対象
こちらもご覧ください
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET