GridColumnStylesCollection.Clear メソッド
DataGridColumnStyle オブジェクトのコレクションを削除します。
Public Sub Clear()
[C#]
public void Clear();
[C++]
public: void Clear();
[JScript]
public function Clear();
使用例
Private Sub Clear_Clicked(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearButton.Click
' TablesAlreadyAdded set to false so that table styles can be added again.
TablesAlreadyAdded = False
myLabel.Text = "All Table Styles Cleared."
' Clear all the column styles and also table style for the grid.
Dim myTableStyle As DataGridTableStyle
For Each myTableStyle In myDataGrid.TableStyles
Dim myColumns As GridColumnStylesCollection = myTableStyle.GridColumnStyles
myColumns.Clear()
Next myTableStyle
myDataGrid.TableStyles.Clear()
End Sub 'Clear_Clicked
[C#]
private void Clear_Clicked(object sender, System.EventArgs e)
{
// TablesAlreadyAdded set to false so that table styles can be added again.
TablesAlreadyAdded = false;
myLabel.Text = "All Table Styles Cleared.";
// Clear all the column styles and also table style for the grid.
foreach (DataGridTableStyle myTableStyle in myDataGrid.TableStyles)
{
GridColumnStylesCollection myColumns = myTableStyle.GridColumnStyles;
myColumns.Clear();
}
myDataGrid.TableStyles.Clear();
}
[C++]
private:
void Clear_Clicked(Object* /*sender*/, System::EventArgs* /*e*/) {
// TablesAlreadyAdded set to false so that table styles can be added again.
TablesAlreadyAdded = false;
myLabel->Text = S"All Table Styles Cleared.";
// Clear all the column styles and also table style for the grid.
IEnumerator* myEnum = myDataGrid->TableStyles->GetEnumerator();
while (myEnum->MoveNext()) {
DataGridTableStyle* myTableStyle =
__try_cast<DataGridTableStyle*>(myEnum->Current);
GridColumnStylesCollection* myColumns = myTableStyle->GridColumnStyles;
myColumns->Clear();
}
myDataGrid->TableStyles->Clear();
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
参照
GridColumnStylesCollection クラス | GridColumnStylesCollection メンバ | System.Windows.Forms 名前空間 | Add