ToolStripDropDownClosingEventArgs Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides data for the Closing event.
public ref class ToolStripDropDownClosingEventArgs : System::ComponentModel::CancelEventArgs
public class ToolStripDropDownClosingEventArgs : System.ComponentModel.CancelEventArgs
type ToolStripDropDownClosingEventArgs = class
inherit CancelEventArgs
Public Class ToolStripDropDownClosingEventArgs
Inherits CancelEventArgs
- Inheritance
Examples
The following code example demonstrates the use of this type. In the example, an event handler reports on the occurrence of the Closing event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.
To run the example code, paste it into a project that contains an instance of type ToolStripDropDown named ToolStripDropDown1
. Then ensure that the event handler is associated with the Closing event.
private void ToolStripDropDown1_Closing(Object sender, ToolStripDropDownClosingEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Closing Event" );
}
Private Sub ToolStripDropDown1_Closing(sender as Object, e as ToolStripDropDownClosingEventArgs) _
Handles ToolStripDropDown1.Closing
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "CloseReason", e.CloseReason)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"Closing Event")
End Sub
Remarks
Use data from the ToolStripDropDownClosingEventArgs class to determine which actions to take when the user closes the drop-down list but before the list is closed.
Constructors
ToolStripDropDownClosingEventArgs(ToolStripDropDownCloseReason) |
Initializes a new instance of the ToolStripDropDownClosingEventArgs class with the specified reason for closing. |
Properties
Cancel |
Gets or sets a value indicating whether the event should be canceled. (Inherited from CancelEventArgs) |
CloseReason |
Gets the reason that the ToolStripDropDown is closing. |
Methods
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
Applies to
See also
Atsauksmes
https://aka.ms/ContentUserFeedback.
Drīzumā: 2024. gada laikā mēs pakāpeniski pārtrauksim izmantot “GitHub problēmas” kā atsauksmju par saturu mehānismu un aizstāsim to ar jaunu atsauksmju sistēmu. Papildinformāciju skatiet:Iesniegt un skatīt atsauksmes par