DataGridViewButtonColumn.UseColumnTextForButtonValue プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
Text プロパティの値が、この列に含まれるセルのボタン テキストとして表示されるかどうかを示す値を取得または設定します。
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
プロパティ値
Text プロパティの値が列内のボタンに表示される場合は true
。各セルの FormattedValue プロパティの値がボタンに表示される場合は false
。 既定値は、false
です。
例外
CellTemplate プロパティの値が null
です。
例
次のコード例では、このプロパティの使用方法を示します。
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
注釈
既定では、ボタン セルの が DataGridViewCell.FormattedValue ボタンのテキストとして表示されます。 UseColumnTextForButtonValueプロパティを使用すると、各セルのボタン テキストを設定したり、すべてのボタン セルにTextプロパティ値を使用したりできます。
このプロパティを取得または設定すると、 UseColumnTextForButtonValue プロパティによって返されるオブジェクトのプロパティを CellTemplate 取得または設定します。 このプロパティを設定すると、列内のすべてのセルの プロパティも設定 UseColumnTextForButtonValue され、列の表示が更新されます。 個々のセルに対して指定した値をオーバーライドするには、列の値を設定した後にセル値を設定します。
適用対象
こちらもご覧ください
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示