'宣言 Public Property AllowAddNew As AllowAddNew
public AllowAddNew AllowAddNew {get; set;}
このプロパティは、指定されたオーバーライドによって制御されるバンドまたはグリッドのデータにユーザーが新しい行を追加できるかどうかを決定します。また、行追加に使用するユーザー インターフェイスの種類も指定します。
Yes を使用する場合は、 ultraGrid1.DisplayLayout.AddNewBox.Hidden を設定して AddNew ボックスを有効にする必要があります。AddNew ボックスを表示に設定した場合、このプロパティは AddNew ボックスのボタンの外観も制御します。AllowAddNew が特定のバンドの 2 (No) に設定されている場合、そのバンドのボタンは AddNew ボックスで無効になります。この結果、ユーザーは指定されたバンドに新しいデータを追加できなくなります。
TabRepeat は、新しいデータを迅速に入力する手段を提供します。この値に設定すると、複数行のデータをキーボードのみを使用して効率的に入力できるようになります。ユーザーが AddNew 行の最後のセルにデータを入力して [Tab] キーを押すと、新しい行が自動的に追加され、その行の最初のセルに入力カーソルが配置されます。TemplateOnBottom、TemplateOnTopWithTabRepeat、FixedOnBottom および FixedOnTop の各設定も、キーボードのみを使用した迅速な新規データ入力に役立ちます。使用可能なすべてのオプションの詳細については、AllowAddNew 列挙体を参照してください。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Button31_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button31.Click ' There are three properties off the override that control whether modifying rows ' as well as adding and deleting rows are allowed. If you set these properties ' on the Override off the DisplayLayout, then these settings apply to the whole ' UltraGrid. Me.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.True Me.ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.No Me.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False ' You can set them on a specific band as well. These settings override those ' set on the DisplayLayout's Override object for this band. Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowUpdate = DefaultableBoolean.True Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowAddNew = AllowAddNew.No Me.ultraGrid1.DisplayLayout.Bands(0).Override.AllowDelete = DefaultableBoolean.False ' There are Activation properties on row, column and cells that dictate whether ' associated cells can be modified, or can even enter in edit mode. Dim column As UltraGridColumn = Me.ultraGrid1.DisplayLayout.Bands(0).Columns("CustomerID") Dim row As UltraGridRow = Me.ultraGrid1.Rows(0) ' Set the CellActivation off the column something other than AllowEdit to prevent ' the user from modifying cells in that column. ActivateOnly allows the user to ' go into edit mode so the user can select and copy text, however the cell will ' be read-only thus preventing any data modification. column.CellActivation = Activation.ActivateOnly ' You can override cell activation setting for a particular row. row.Activation = Activation.ActivateOnly ' Furthermore you can override activation on a cell as well. row.Cells(column).Activation = Activation.AllowEdit End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button31_Click(object sender, System.EventArgs e) { // There are three properties off the override that control whether modifying rows // as well as adding and deleting rows are allowed. If you set these properties // on the Override off the DisplayLayout, then these settings apply to the whole // UltraGrid. this.ultraGrid1.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.True; this.ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.No; this.ultraGrid1.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False; // You can set them on a specific band as well. These settings override those // set on the DisplayLayout's Override object for this band. this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.True; this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowAddNew = AllowAddNew.No; this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowDelete = DefaultableBoolean.False; // There are Activation properties on row, column and cells that dictate whether // associated cells can be modified, or can even enter in edit mode. UltraGridColumn column = this.ultraGrid1.DisplayLayout.Bands[0].Columns["CustomerID"]; UltraGridRow row = this.ultraGrid1.Rows[0]; // Set the CellActivation off the column something other than AllowEdit to prevent // the user from modifying cells in that column. ActivateOnly allows the user to // go into edit mode so the user can select and copy text, however the cell will // be read-only thus preventing any data modification. column.CellActivation = Activation.ActivateOnly; // You can override cell activation setting for a particular row. row.Activation = Activation.ActivateOnly; // Furthermore you can override activation on a cell as well. row.Cells[column].Activation = Activation.AllowEdit; }