次の方法で共有


ISelectionService.SelectionChanged イベント

現在選択されている対象が変更されたときに発生します。

名前空間: System.ComponentModel.Design
アセンブリ: System (system.dll 内)

構文

'宣言
Event SelectionChanged As EventHandler
'使用
Dim instance As ISelectionService
Dim handler As EventHandler

AddHandler instance.SelectionChanged, handler
event EventHandler SelectionChanged
event EventHandler^ SelectionChanged {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
/** @event */
void add_SelectionChanged (EventHandler value)

/** @event */
void remove_SelectionChanged (EventHandler value)
JScript では、イベントは使用できますが、新規に宣言することはできません。

解説

このイベント ハンドラ内で行われる処理はフォーム デザイナの全体的なパフォーマンスに影響する可能性が高いため、このイベントを処理するときは最低限の処理に抑えてください。

使用例

SelectionChanged イベントを使用する方法を次の例に示します。

               ' Add SelectionChanged event handler to event
               AddHandler m_selectionService.SelectionChanged, AddressOf OnSelectionChanged

...
      ' This is the OnSelectionChanged handler method.  This method calls
      '  OnUserChange to display a message that indicates the name of the
      '  handler that made the call and the type of the event argument. 
      Private Sub OnSelectionChanged(ByVal sender As Object, ByVal args As EventArgs)
         OnUserChange("OnSelectionChanged", args.ToString())
      End Sub 'OnSelectionChanged
                    // Add SelectionChanged event handler to event
                    m_selectionService.SelectionChanged += new EventHandler(OnSelectionChanged);

...
        /* This is the OnSelectionChanged handler method.  This method calls
            OnUserChange to display a message that indicates the name of the
            handler that made the call and the type of the event argument. */
        private void OnSelectionChanged(object sender, EventArgs args) 
        {
            OnUserChange("OnSelectionChanged", args.ToString());
        }
            // Add SelectionChanged event handler to event
            m_selectionService->SelectionChanged += gcnew EventHandler( this, &ComponentClass::OnSelectionChanged );

...
   /* This is the OnSelectionChanged handler method.  This method calls
       OnUserChange to display a message that indicates the name of the
       handler that made the call and the type of the event argument. */
   void OnSelectionChanged( Object^ /*sender*/, EventArgs^ args )
   {
      OnUserChange( "OnSelectionChanged", args->ToString() );
   }
            // Add SelectionChanged event handler to event
            mSelectionService.add_SelectionChanged(
                new EventHandler(OnSelectionChanged));

...
    /* This is the OnSelectionChanged handler method.  This method calls
            OnUserChange to display a message that indicates the name of the
            handler that made the call and the type of the event argument. 
     */
    private void OnSelectionChanged(Object sender, EventArgs args)
    {
        OnUserChange("OnSelectionChanged", args.ToString());
    } //OnSelectionChanged

プラットフォーム

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

ISelectionService インターフェイス
ISelectionService メンバ
System.ComponentModel.Design 名前空間
SelectionChanging
EventHandler