View.Deactivate イベント
アセンブリ: System.Web (system.web.dll 内)

public: event EventHandler^ Deactivate { void add (EventHandler^ value); void remove (EventHandler^ value); }
/** @event */ public void add_Deactivate (EventHandler value) /** @event */ public void remove_Deactivate (EventHandler value)

Deactivate イベントは、現在のアクティブ View コントロールがアクティブでなくなったときに発生します。View コントロールは、ActiveViewIndex プロパティの値が変更されるか、SetActiveView メソッドが呼び出されて別の View コントロールが指定された場合にアクティブではなくなります。たとえば、View1 が MultiView コントロール内のアクティブ ビューである場合に、ActiveViewIndex プロパティが変更されて View2 が指定されると、View1 に対して Deactivate イベントが発生し、View2 に対して Activate イベントが発生します。

View コントロールの Deactivate イベントのイベント ハンドラを指定およびコード化する方法を次のコード例に示します。アクティブ ビューが変更されると、Activate イベントを発生させた View コントロールと、Deactivate イベントを発生させた View コントロールを指定するメッセージがユーザーに表示されます。
<%@ Page Language="VB" %> <html> <head> <script runat="server"> Sub Index_Changed(ByVal Sender As Object, ByVal e As EventArgs) ' Set the active view to ' the view selected by the user. Dim str As String = ViewListBox.SelectedItem.Text Select Case (str) Case "DefaultView" MultiView1.SetActiveView(DefaultView) Case "NewsView" MultiView1.SetActiveView(NewsView) Case "ShoppingView" MultiView1.SetActiveView(ShoppingView) End Select End Sub ' The handler for the DefaultView's Activate event. Sub DefaultView_Activate(ByVal sender As Object, ByVal e As EventArgs) ' Notify the user that the event was raised. ActivateLabel.Text = "The Activate event was raised for the DefaultView." End Sub ' The handler for the DefaultView's Deactivate event. Sub DefaultView_Deactivate(ByVal sender As Object, ByVal e As EventArgs) ' Notify the user that the event was raised. DeactivateLabel.Text = "The Deactivate event was raised for the DefaultView." End Sub ' The handler for the ShoppingView's Activate event. Sub ShoppingView_Activate(ByVal sender As Object, ByVal e As EventArgs) ' Notify the user that the event was raised. ActivateLabel.Text = "The Activate event was raised for the ShoppingView." End Sub ' The handler for the ShoppingView's Deactivate event. Sub ShoppingView_Deactivate(ByVal sender As Object, ByVal e As EventArgs) ' Notify the user that the event was raised. DeactivateLabel.Text = "The Deactivate event was raised for the ShoppingView." End Sub ' The handler for the NewsView's Activate event. Sub NewsView_Activate(ByVal sender As Object, ByVal e As EventArgs) ' Notify the user that the event was raised. ActivateLabel.Text = "The Activate event was raised for the NewsView." End Sub ' The handler for the NewsView's Deactivate event. Sub NewsView_Deactivate(ByVal sender As Object, ByVal e As EventArgs) ' Notify the user that the event was raised. DeactivateLabel.Text = "The Deactivate event was raised for the NewsView." End Sub </script> </html> <body> <form ID="Form1" runat="server"> <h3>View Activate and Deactivate Events Example</h3> <h4>Select a view to display in a MultiView control:</h4> <asp:ListBox id="ViewListBox" Rows="1" SelectionMode="Single" AutoPostBack="True" OnselectedIndexChanged="Index_Changed" runat="Server"> <asp:ListItem Value=0>DefaultView</asp:ListItem> <asp:ListItem Value=1>NewsView</asp:ListItem> <asp:ListItem Value=2>ShoppingView</asp:ListItem> </asp:ListBox><br><br> <hr> <asp:MultiView id="MultiView1" runat="Server"> <asp:View id="DefaultView" OnActivate="DefaultView_Activate" OnDeactivate="DefaultView_Deactivate" runat="Server"> <asp:Panel id="DefaultPanel1" Width="250px" BackColor="#C0C0FF" BorderColor="#404040" BorderStyle="Double" runat="Server"> <asp:Label id="DefaultLabel1" Font-bold="true" Font-size="20" Text="The Default View" runat="Server"> </asp:Label> </asp:Panel> </asp:View> <asp:View id="NewsView" OnActivate="NewsView_Activate" OnDeactivate="NewsView_Deactivate" runat="Server"> <asp:Panel id="NewsPanel1" Width="250px" BackColor="#C0FFC0" BorderColor="#404040" BorderStyle="Double" runat="Server"> <asp:Label id="NewsLabel1" Font-bold="true" Font-size="20" Text="The News View" runat="Server"> </asp:Label> </asp:Panel> </asp:View> <asp:View id="ShoppingView" OnActivate="ShoppingView_Activate" OnDeactivate="ShoppingView_Deactivate" runat="Server"> <asp:Panel id="ShoppingPanel1" Width="250px" BackColor="#FFFFC0" BorderColor="#404040" BorderStyle="Double" runat="Server"> <asp:Label id="ShoppingLabel1" Font-Bold="true" Font-size="20" Text="The Shopping View" runat="Server"> </asp:Label> </asp:Panel> </asp:View> </asp:MultiView><br><br> <asp:Label ID="ActivateLabel" BackColor="#ffff66" runat="Server"> </asp:Label><br> <asp:Label ID="DeactivateLabel" BackColor="#ffff66" runat="Server"> </asp:Label> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からView.Deactivate イベントを検索する場合は、下記のリンクをクリックしてください。

- View.Deactivate イベントのページへのリンク