ActiveDesignerEventHandler 代理人
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ActiveDesignerChanged イベントを処理するメソッドを表します。
public delegate void ActiveDesignerEventHandler(System::Object ^ sender, ActiveDesignerEventArgs ^ e);
public delegate void ActiveDesignerEventHandler(object sender, ActiveDesignerEventArgs e);
public delegate void ActiveDesignerEventHandler(object? sender, ActiveDesignerEventArgs e);
type ActiveDesignerEventHandler = delegate of obj * ActiveDesignerEventArgs -> unit
Public Delegate Sub ActiveDesignerEventHandler(sender As Object, e As ActiveDesignerEventArgs)
- sender
- Object
イベントのソース。
イベント データを格納している ActiveDesignerEventArgs。
次の例では、 を登録し、イベントを ActiveDesignerEventHandler 処理する方法を ActiveDesignerChanged 示します。
public:
void LinkActiveDesignerEvent( IDesignerEventService^ eventService )
{
// Registers an event handler for the ActiveDesignerChanged event.
eventService->ActiveDesignerChanged += gcnew ActiveDesignerEventHandler( this, &MiscCompModSamples::ActiveDesignerEventHandlerExample::OnActiveDesignerEvent );
}
private:
void OnActiveDesignerEvent( Object^ /*sender*/, ActiveDesignerEventArgs^ e )
{
// Displays changed designer information on the console.
if ( e->NewDesigner->RootComponent->Site != nullptr )
{
Console::WriteLine( "Name of the component of the new active designer: {0}", e->NewDesigner->RootComponent->Site->Name );
}
Console::WriteLine( "Type of the component of the new active designer: {0}", e->NewDesigner->RootComponentClassName );
if ( e->OldDesigner->RootComponent->Site != nullptr )
{
Console::WriteLine( "Name of the component of the previously active designer: {0}", e->OldDesigner->RootComponent->Site->Name );
}
Console::WriteLine( "Type of the component of the previously active designer: {0}", e->OldDesigner->RootComponentClassName );
}
public void LinkActiveDesignerEvent(IDesignerEventService eventService)
{
// Registers an event handler for the ActiveDesignerChanged event.
eventService.ActiveDesignerChanged += new ActiveDesignerEventHandler(this.OnActiveDesignerEvent);
}
private void OnActiveDesignerEvent(object sender, ActiveDesignerEventArgs e)
{
// Displays changed designer information on the console.
if( e.NewDesigner.RootComponent.Site != null )
Console.WriteLine("Name of the component of the new active designer: "+e.NewDesigner.RootComponent.Site.Name);
Console.WriteLine("Type of the component of the new active designer: "+e.NewDesigner.RootComponentClassName);
if( e.OldDesigner.RootComponent.Site != null )
Console.WriteLine("Name of the component of the previously active designer: "+e.OldDesigner.RootComponent.Site.Name);
Console.WriteLine("Type of the component of the previously active designer: "+e.OldDesigner.RootComponentClassName);
}
Public Sub LinkActiveDesignerEvent(ByVal eventService As IDesignerEventService)
' Registers an event handler for the ActiveDesignerChanged event.
AddHandler eventService.ActiveDesignerChanged, AddressOf Me.OnActiveDesignerEvent
End Sub
Private Sub OnActiveDesignerEvent(ByVal sender As Object, ByVal e As ActiveDesignerEventArgs)
' Displays changed designer information on the console.
If (e.NewDesigner.RootComponent.Site IsNot Nothing) Then
Console.WriteLine(("Name of the component of the new active designer: " + e.NewDesigner.RootComponent.Site.Name))
End If
Console.WriteLine(("Type of the component of the new active designer: " + e.NewDesigner.RootComponentClassName))
If (e.OldDesigner.RootComponent.Site IsNot Nothing) Then
Console.WriteLine(("Name of the component of the previously active designer: " + e.OldDesigner.RootComponent.Site.Name))
End If
Console.WriteLine(("Type of the component of the previously active designer: " + e.OldDesigner.RootComponentClassName))
End Sub
イベントは ActiveDesignerChanged 、現在作業中の文書が変更されたときに発生します。
ActiveDesignerEventHandler デリゲートを作成する場合は、イベントを処理するメソッドを指定します。 イベント ハンドラーにイベントを関連付けるには、イベントにデリゲートのインスタンスを追加します。 イベント ハンドラーは、デリゲートを削除しない限り、イベントが発生するたびに呼び出されます。 イベント ハンドラー デリゲートの詳細については、「イベントの 処理と発生」を参照してください。
Get |
指定したデリゲートによって表されるメソッドを表すオブジェクトを取得します。 |
製品 | バージョン |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。