DataGrid.CaptionVisibleChanged イベント
CaptionVisible プロパティが変更された場合に発生します。
Public Event CaptionVisibleChanged As EventHandler
[C#]
public event EventHandler CaptionVisibleChanged;
[C++]
public: __event EventHandler* CaptionVisibleChanged;
[JScript] JScript では、このクラスで定義されているイベントを処理できます。ただし、独自に定義することはできません。
イベント データ
イベント ハンドラが EventArgs 型の引数を受け取りました。
解説
イベント処理の詳細については、「 イベントの利用 」を参照してください。
使用例
' Create an instance of the 'CaptionVisibleChanged' EventHandler.
Private Sub CallCaptionVisibleChanged()
AddHandler myDataGrid.CaptionVisibleChanged, AddressOf Grid_CaptionVisibleChanged
End Sub 'CallCaptionVisibleChanged
' Set the 'CaptionVisible' property on click of a button.
Protected Sub myButton_Click(sender As Object, e As EventArgs)
If myDataGrid.CaptionVisible = True Then
myDataGrid.CaptionVisible = False
Else
myDataGrid.CaptionVisible = True
End If
End Sub 'myButton_Click
' Raise the event when 'CaptionVisible' property is changed.
Protected Sub Grid_CaptionVisibleChanged(sender As Object, e As EventArgs)
' String variable used to show message.
Dim myString As String = "CaptionVisibleChanged event raised, caption is"
' Get the state of 'CaptionVisible' property.
Dim myBool As Boolean = myDataGrid.CaptionVisible
' Create appropriate alert message.
myString +=IIf(myBool ," " , " not ") + "visible"
' Show information about caption of DataGrid.
MessageBox.Show(myString, "Caption information")
End Sub 'Grid_CaptionVisibleChanged
[C#]
// Create an instance of the 'CaptionVisibleChanged' EventHandler.
private void CallCaptionVisibleChanged()
{
myDataGrid.CaptionVisibleChanged +=
new EventHandler(Grid_CaptionVisibleChanged);
}
// Set the 'CaptionVisible' property on click of a button.
protected void myButton_Click(object sender, EventArgs e)
{
if (myDataGrid.CaptionVisible == true)
myDataGrid.CaptionVisible = false;
else
myDataGrid.CaptionVisible = true;
}
// Raise the event when 'CaptionVisible' property is changed.
protected void Grid_CaptionVisibleChanged(object sender, EventArgs e)
{
// String variable used to show message.
string myString = "CaptionVisibleChanged event raised, caption is";
// Get the state of 'CaptionVisible' property.
bool myBool = myDataGrid.CaptionVisible;
// Create appropriate alert message.
myString += (myBool ? " " : " not ") + "visible";
// Show information about caption of DataGrid.
MessageBox.Show(myString, "Caption information");
}
[C++]
// Create an instance of the 'CaptionVisibleChanged' EventHandler.
private:
void CallCaptionVisibleChanged() {
myDataGrid->CaptionVisibleChanged +=
new EventHandler(this, &MyDataGrid::Grid_CaptionVisibleChanged);
}
// Set the 'CaptionVisible' property on click of a button.
protected:
void myButton_Click(Object* /*sender*/, EventArgs* /*e*/) {
if (myDataGrid->CaptionVisible == true)
myDataGrid->CaptionVisible = false;
else
myDataGrid->CaptionVisible = true;
}
// Raise the event when 'CaptionVisible' property is changed.
void Grid_CaptionVisibleChanged(Object* /*sender*/, EventArgs* /*e*/) {
// String variable used to show message.
String* myString = S"CaptionVisibleChanged event raised, caption is";
// Get the state of 'CaptionVisible' property.
bool myBool = myDataGrid->CaptionVisible;
// Create appropriate alert message.
myString = String::Concat(myString, myBool ? S" " : S" not ", S"visible");
// Show information about caption of DataGrid.
MessageBox::Show(myString, S"Caption information");
}
[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 ファミリ