列スタイル オブジェクトの配列をコレクションに追加します。
Public Sub AddRange( _
ByVal columns() As DataGridColumnStyle _)
[C#]
public void AddRange(DataGridColumnStyle[] columns);
[C++]
public: void AddRange(DataGridColumnStyle* columns[]);
[JScript]
public function AddRange(
columns : DataGridColumnStyle[]);
パラメータ
- columns
コレクションに追加する DataGridColumnStyle オブジェクトの配列。
使用例
DataGridColumnStyle オブジェクトの配列を作成し、 AddRange メソッドを使用して、その配列を GridColumnStylesCollection オブジェクトに追加する例を次に示します。
Private Sub AddStyleRange()
' Create two DataGridColumnStyle objects.
Dim col1 As New DataGridTextBoxColumn()
col1.MappingName = "FirstName"
Dim col2 As New DataGridBoolColumn()
col2.MappingName = "Current"
' Create an array and use AddRange to add to collection.
Dim cols() As DataGridColumnStyle = {col1, col2}
dataGrid1.TableStyles(0).GridColumnStyles.AddRange(cols)
End Sub
[C#]
private void AddStyleRange()
{
// Create two DataGridColumnStyle objects.
DataGridColumnStyle col1 = new DataGridTextBoxColumn();
col1.MappingName = "FirstName";
DataGridColumnStyle col2 = new DataGridBoolColumn();
col2.MappingName = "Current";
// Create an array and use AddRange to add to collection.
DataGridColumnStyle[] cols = new DataGridColumnStyle[2] {col1, col2};
dataGrid1.TableStyles[0].GridColumnStyles.AddRange(cols);
}
[C++]
private:
void AddStyleRange()
{
// Create two DataGridColumnStyle objects.
DataGridColumnStyle* col1 = new DataGridTextBoxColumn();
col1->MappingName = S"FirstName";
DataGridColumnStyle* col2 = new DataGridBoolColumn();
col2->MappingName = S"Current";
// Create an array and use AddRange to add to collection.
DataGridColumnStyle* cols[] = {col1, col2};
dataGrid1->TableStyles->Item[0]->GridColumnStyles->AddRange(cols);
}
[JScript]
function AddStyleRange(dataGrid: DataGrid)
{
// Create two DataGridColumnStyle objects.
var col1: DataGridColumnStyle = new DataGridTextBoxColumn();
col1.MappingName = "FirstName";
var col2: DataGridColumnStyle = new DataGridBoolColumn();
col2.MappingName = "Current";
// Create an array and use AddRange to add to collection.
var cols: DataGridColumnStyle[] = [col1, col2];
dataGrid.TableStyles[0].GridColumnStyles.AddRange(cols);
}
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
GridColumnStylesCollection クラス | GridColumnStylesCollection メンバ | System.Windows.Forms 名前空間