ToolStripControlHost Class
Hosts custom controls or Windows Forms controls.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The ToolStripControlHost type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | ToolStripControlHost(Control) | Initializes a new instance of the ToolStripControlHost class that hosts the specified control. |
![]() | ToolStripControlHost(Control, String) | Initializes a new instance of the ToolStripControlHost class that hosts the specified control and that has the specified name. |
| Name | Description | |
|---|---|---|
![]() | AccessibilityObject | Gets the AccessibleObject assigned to the control. (Inherited from ToolStripItem.) |
![]() | AccessibleDefaultActionDescription | Gets or sets the default action description of the control for use by accessibility client applications. (Inherited from ToolStripItem.) |
![]() | AccessibleDescription | Gets or sets the description that will be reported to accessibility client applications. (Inherited from ToolStripItem.) |
![]() | AccessibleName | Gets or sets the name of the control for use by accessibility client applications. (Inherited from ToolStripItem.) |
![]() | AccessibleRole | Gets or sets the accessible role of the control, which specifies the type of user interface element of the control. (Inherited from ToolStripItem.) |
![]() | Alignment | Gets or sets a value indicating whether the item aligns towards the beginning or end of the ToolStrip. (Inherited from ToolStripItem.) |
![]() | AllowDrop | Gets or sets a value indicating whether drag-and-drop and item reordering are handled through events that you implement. (Inherited from ToolStripItem.) |
![]() | Anchor | Gets or sets the edges of the container to which a ToolStripItem is bound and determines how a ToolStripItem is resized with its parent. (Inherited from ToolStripItem.) |
![]() | AutoSize | Gets or sets a value indicating whether the item is automatically sized. (Inherited from ToolStripItem.) |
![]() | AutoToolTip | Gets or sets a value indicating whether to use the Text property or the ToolTipText property for the ToolStripItem ToolTip. (Inherited from ToolStripItem.) |
![]() | Available | Gets or sets a value indicating whether the ToolStripItem should be placed on a ToolStrip. (Inherited from ToolStripItem.) |
![]() | BackColor | Gets or sets the background color for the item. (Overrides ToolStripItem::BackColor.) |
![]() | BackgroundImage | Gets or sets the background image displayed in the control. (Overrides ToolStripItem::BackgroundImage.) |
![]() | BackgroundImageLayout | Gets or sets the background image layout as defined in the ImageLayout enumeration. (Overrides ToolStripItem::BackgroundImageLayout.) |
![]() | Bounds | Gets the size and location of the item. (Inherited from ToolStripItem.) |
![]() | CanRaiseEvents | Gets a value indicating whether the component can raise an event. (Inherited from Component.) |
![]() | CanSelect | Gets a value indicating whether the control can be selected. (Overrides ToolStripItem::CanSelect.) |
![]() | CausesValidation | Gets or sets a value indicating whether the hosted control causes and raises validation events on other controls when the hosted control receives focus. |
![]() | Container | Gets the IContainer that contains the Component. (Inherited from Component.) |
![]() | ContentRectangle | Gets the area where content, such as text and icons, can be placed within a ToolStripItem without overwriting background borders. (Inherited from ToolStripItem.) |
![]() | Control | Gets the Control that this ToolStripControlHost is hosting. |
![]() | ControlAlign | Gets or sets the alignment of the control on the form. |
![]() | DefaultAutoToolTip | Gets a value indicating whether to display the ToolTip that is defined as the default. (Inherited from ToolStripItem.) |
![]() | DefaultDisplayStyle | Gets a value indicating what is displayed on the ToolStripItem. (Inherited from ToolStripItem.) |
![]() | DefaultMargin | Gets the default margin of an item. (Inherited from ToolStripItem.) |
![]() | DefaultPadding | Gets the internal spacing characteristics of the item. (Inherited from ToolStripItem.) |
![]() | DefaultSize | Gets the default size of the control. (Overrides ToolStripItem::DefaultSize.) |
![]() | DesignMode | Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.) |
![]() | DismissWhenClicked | Gets a value indicating whether items on a ToolStripDropDown are hidden after they are clicked. (Inherited from ToolStripItem.) |
![]() | DisplayStyle | Infrastructure. This property is not relevant to this class. |
![]() | Dock | Gets or sets which ToolStripItem borders are docked to its parent control and determines how a ToolStripItem is resized with its parent. (Inherited from ToolStripItem.) |
![]() | DoubleClickEnabled | Infrastructure. This property is not relevant to this class. |
![]() | Enabled | Gets or sets a value indicating whether the parent control of the ToolStripItem is enabled. (Overrides ToolStripItem::Enabled.) |
![]() | Events | Gets the list of event handlers that are attached to this Component. (Inherited from Component.) |
![]() | Focused | Gets a value indicating whether the control has input focus. |
![]() | Font | Gets or sets the font to be used on the hosted control. (Overrides ToolStripItem::Font.) |
![]() | ForeColor | Gets or sets the foreground color of the hosted control. (Overrides ToolStripItem::ForeColor.) |
![]() | Height | Gets or sets the height, in pixels, of a ToolStripItem. (Inherited from ToolStripItem.) |
![]() | Image | Infrastructure. This property is not relevant to this class. (Overrides ToolStripItem::Image.) |
![]() | ImageAlign | Infrastructure. This property is not relevant to this class. |
![]() | ImageIndex | Gets or sets the index value of the image that is displayed on the item. (Inherited from ToolStripItem.) |
![]() | ImageKey | Gets or sets the key accessor for the image in the ImageList that is displayed on a ToolStripItem. (Inherited from ToolStripItem.) |
![]() | ImageScaling | Infrastructure. This property is not relevant to this class. |
![]() | ImageTransparentColor | This property is not relevant to this class. |
![]() | IsDisposed | Gets a value indicating whether the object has been disposed of. (Inherited from ToolStripItem.) |
![]() | IsOnDropDown | Gets a value indicating whether the container of the current Control is a ToolStripDropDown. (Inherited from ToolStripItem.) |
![]() | IsOnOverflow | Gets a value indicating whether the Placement property is set to Overflow. (Inherited from ToolStripItem.) |
![]() | Margin | Gets or sets the space between the item and adjacent items. (Inherited from ToolStripItem.) |
![]() | MergeAction | Gets or sets how child menus are merged with parent menus. (Inherited from ToolStripItem.) |
![]() | MergeIndex | Gets or sets the position of a merged item within the current ToolStrip. (Inherited from ToolStripItem.) |
![]() | Name | Gets or sets the name of the item. (Inherited from ToolStripItem.) |
![]() | Overflow | Gets or sets whether the item is attached to the ToolStrip or ToolStripOverflowButton or can float between the two. (Inherited from ToolStripItem.) |
![]() | Owner | Gets or sets the owner of this item. (Inherited from ToolStripItem.) |
![]() | OwnerItem | Gets the parent ToolStripItem of this ToolStripItem. (Inherited from ToolStripItem.) |
![]() | Padding | Gets or sets the internal spacing, in pixels, between the item's contents and its edges. (Inherited from ToolStripItem.) |
![]() | Parent | Gets or sets the parent container of the ToolStripItem. (Inherited from ToolStripItem.) |
![]() | Placement | Gets the current layout of the item. (Inherited from ToolStripItem.) |
![]() | Pressed | Gets a value indicating whether the state of the item is pressed. (Inherited from ToolStripItem.) |
![]() | RightToLeft | Gets or sets a value indicating whether items are to be placed from right to left and text is to be written from right to left. (Overrides ToolStripItem::RightToLeft.) |
![]() | RightToLeftAutoMirrorImage | Infrastructure. This property is not relevant to this class. |
![]() | Selected | Gets a value indicating whether the item is selected. (Overrides ToolStripItem::Selected.) |
![]() | ShowKeyboardCues | Gets a value indicating whether to show or hide shortcut keys. (Inherited from ToolStripItem.) |
![]() | Site | Gets or sets the site of the hosted control. (Overrides Component::Site.) |
![]() | Size | Gets or sets the size of the ToolStripItem. (Overrides ToolStripItem::Size.) |
![]() | Tag | Gets or sets the object that contains data about the item. (Inherited from ToolStripItem.) |
![]() | Text | Gets or sets the text to be displayed on the hosted control. (Overrides ToolStripItem::Text.) |
![]() | TextAlign | Infrastructure. This property is not relevant to this class. |
![]() | TextDirection | Infrastructure. This property is not relevant to this class. (Overrides ToolStripItem::TextDirection.) |
![]() | TextImageRelation | Infrastructure. This property is not relevant to this class. |
![]() | ToolTipText | Gets or sets the text that appears as a ToolTip for a control. (Inherited from ToolStripItem.) |
![]() | Visible | Gets or sets a value indicating whether the item is displayed. (Inherited from ToolStripItem.) |
![]() | Width | Gets or sets the width in pixels of a ToolStripItem. (Inherited from ToolStripItem.) |
| Name | Description | |
|---|---|---|
![]() | CreateAccessibilityInstance | Creates a new accessibility object for the ToolStripItem. (Overrides ToolStripItem::CreateAccessibilityInstance().) |
![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
![]() | Dispose() | Releases all resources used by the Component. (Inherited from Component.) |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the ToolStripControlHost and optionally releases the managed resources. (Overrides ToolStripItem::Dispose(Boolean).) |
![]() | DoDragDrop | Begins a drag-and-drop operation. (Inherited from ToolStripItem.) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.) |
![]() | Focus | Gives the focus to a control. |
![]() | GetCurrentParent | Retrieves the ToolStrip that is the container of the current ToolStripItem. (Inherited from ToolStripItem.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | GetPreferredSize | Retrieves the size of a rectangular area into which a control can be fitted. (Overrides ToolStripItem::GetPreferredSize(Size).) |
![]() | GetService | Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | Invalidate() | Invalidates the entire surface of the ToolStripItem and causes it to be redrawn. (Inherited from ToolStripItem.) |
![]() | Invalidate(Rectangle) | Invalidates the specified region of the ToolStripItem by adding it to the update region of the ToolStripItem, which is the area that will be repainted at the next paint operation, and causes a paint message to be sent to the ToolStripItem. (Inherited from ToolStripItem.) |
![]() | IsInputChar | Determines whether a character is an input character that the item recognizes. (Inherited from ToolStripItem.) |
![]() | IsInputKey | Determines whether the specified key is a regular input key or a special key that requires preprocessing. (Inherited from ToolStripItem.) |
![]() | MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
![]() | OnAvailableChanged | Raises the AvailableChanged event. (Inherited from ToolStripItem.) |
![]() | OnBackColorChanged | Raises the BackColorChanged event. (Inherited from ToolStripItem.) |
![]() | OnBoundsChanged | Occurs when the Bounds property changes. (Overrides ToolStripItem::OnBoundsChanged().) |
![]() | OnClick | Raises the Click event. (Inherited from ToolStripItem.) |
![]() | OnDisplayStyleChanged | Raises the DisplayStyleChanged event. (Inherited from ToolStripItem.) |
![]() | OnDoubleClick | Raises the DoubleClick event. (Inherited from ToolStripItem.) |
![]() | OnDragDrop | Raises the DragDrop event. (Inherited from ToolStripItem.) |
![]() | OnDragEnter | Raises the DragEnter event. (Inherited from ToolStripItem.) |
![]() | OnDragLeave | Raises the DragLeave event. (Inherited from ToolStripItem.) |
![]() | OnDragOver | Raises the DragOver event. (Inherited from ToolStripItem.) |
![]() | OnEnabledChanged | Raises the EnabledChanged event. (Inherited from ToolStripItem.) |
![]() | OnEnter | Raises the Enter event. |
![]() | OnFontChanged | Raises the FontChanged event. (Inherited from ToolStripItem.) |
![]() | OnForeColorChanged | Raises the ForeColorChanged event. (Inherited from ToolStripItem.) |
![]() | OnGiveFeedback | Raises the GiveFeedback event. (Inherited from ToolStripItem.) |
![]() | OnGotFocus | Raises the GotFocus event. |
![]() | OnHostedControlResize | Synchronizes the resizing of the control host with the resizing of the hosted control. |
![]() | OnKeyDown | Raises the KeyDown event. |
![]() | OnKeyPress | Raises the KeyPress event. |
![]() | OnKeyUp | Raises the KeyUp event. |
![]() | OnLayout | Raises the Layout event. (Overrides ToolStripItem::OnLayout(LayoutEventArgs).) |
![]() | OnLeave | Raises the Leave event. |
![]() | OnLocationChanged | Raises the LocationChanged event. (Inherited from ToolStripItem.) |
![]() | OnLostFocus | Raises the LostFocus event. |
![]() | OnMouseDown | Raises the MouseDown event. (Inherited from ToolStripItem.) |
![]() | OnMouseEnter | Raises the MouseEnter event. (Inherited from ToolStripItem.) |
![]() | OnMouseHover | Raises the MouseHover event. (Inherited from ToolStripItem.) |
![]() | OnMouseLeave | Raises the MouseLeave event. (Inherited from ToolStripItem.) |
![]() | OnMouseMove | Raises the MouseMove event. (Inherited from ToolStripItem.) |
![]() | OnMouseUp | Raises the MouseUp event. (Inherited from ToolStripItem.) |
![]() | OnOwnerChanged | Raises the OwnerChanged event. (Inherited from ToolStripItem.) |
![]() | OnOwnerFontChanged | Raises the FontChanged event when the Font property has changed on the parent of the ToolStripItem. (Inherited from ToolStripItem.) |
![]() | OnPaint | Raises the Paint event. (Overrides ToolStripItem::OnPaint(PaintEventArgs).) |
![]() | OnParentBackColorChanged | Raises the BackColorChanged event. (Inherited from ToolStripItem.) |
![]() | OnParentChanged | Raises the ParentChanged event. (Overrides ToolStripItem::OnParentChanged(ToolStrip, ToolStrip).) |
![]() | OnParentEnabledChanged | Raises the EnabledChanged event when the Enabled property value of the item's container changes. (Inherited from ToolStripItem.) |
![]() | OnParentForeColorChanged | Raises the ForeColorChanged event. (Inherited from ToolStripItem.) |
![]() | OnParentRightToLeftChanged | Raises the RightToLeftChanged event. (Inherited from ToolStripItem.) |
![]() | OnQueryContinueDrag | Raises the QueryContinueDrag event. (Inherited from ToolStripItem.) |
![]() | OnRightToLeftChanged | Raises the RightToLeftChanged event. (Inherited from ToolStripItem.) |
![]() | OnSubscribeControlEvents | Subscribes events from the hosted control. |
![]() | OnTextChanged | Raises the TextChanged event. (Inherited from ToolStripItem.) |
![]() | OnUnsubscribeControlEvents | Unsubscribes events from the hosted control. |
![]() | OnValidated | Raises the Validated event. |
![]() | OnValidating | Raises the Validating event. |
![]() | OnVisibleChanged | Raises the VisibleChanged event. (Inherited from ToolStripItem.) |
![]() | PerformClick | Activates the ToolStripItem when it is clicked with the mouse. (Inherited from ToolStripItem.) |
![]() | ProcessCmdKey | Processes a command key. (Overrides ToolStripItem::ProcessCmdKey(Message%, Keys).) |
![]() | ProcessDialogKey | Processes a dialog key. (Overrides ToolStripItem::ProcessDialogKey(Keys).) |
![]() | ProcessMnemonic | Processes a mnemonic character. (Overrides ToolStripItem::ProcessMnemonic(Char).) |
![]() | ResetBackColor | Infrastructure. This method is not relevant to this class. (Overrides ToolStripItem::ResetBackColor().) |
![]() | ResetDisplayStyle | Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.) |
![]() | ResetFont | Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.) |
![]() | ResetForeColor | Infrastructure. This method is not relevant to this class. (Overrides ToolStripItem::ResetForeColor().) |
![]() | ResetImage | Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.) |
![]() | ResetMargin | Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.) |
![]() | ResetPadding | Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.) |
![]() | ResetRightToLeft | Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.) |
![]() | ResetTextDirection | Infrastructure. This method is not relevant to this class. (Inherited from ToolStripItem.) |
![]() | Select | Selects the item. (Inherited from ToolStripItem.) |
![]() | SetBounds | Sets the size and location of the item. (Inherited from ToolStripItem.) |
![]() | SetVisibleCore | Sets the ToolStripItem to the specified visible state. (Overrides ToolStripItem::SetVisibleCore(Boolean).) |
![]() | ToString | Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from ToolStripItem.) |
| Name | Description | |
|---|---|---|
![]() | AvailableChanged | Occurs when the value of the Available property changes. (Inherited from ToolStripItem.) |
![]() | BackColorChanged | Occurs when the value of the BackColor property changes. (Inherited from ToolStripItem.) |
![]() | Click | Occurs when the ToolStripItem is clicked. (Inherited from ToolStripItem.) |
![]() | DisplayStyleChanged | Infrastructure. This event is not relevant to this class. |
![]() | Disposed | Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.) |
![]() | DoubleClick | Occurs when the item is double-clicked with the mouse. (Inherited from ToolStripItem.) |
![]() | DragDrop | Occurs when the user drags an item and the user releases the mouse button, indicating that the item should be dropped into this item. (Inherited from ToolStripItem.) |
![]() | DragEnter | Occurs when the user drags an item into the client area of this item. (Inherited from ToolStripItem.) |
![]() | DragLeave | Occurs when the user drags an item and the mouse pointer is no longer over the client area of this item. (Inherited from ToolStripItem.) |
![]() | DragOver | Occurs when the user drags an item over the client area of this item. (Inherited from ToolStripItem.) |
![]() | EnabledChanged | Occurs when the Enabled property value has changed. (Inherited from ToolStripItem.) |
![]() | Enter | Occurs when the hosted control is entered. |
![]() | ForeColorChanged | Occurs when the ForeColor property value changes. (Inherited from ToolStripItem.) |
![]() | GiveFeedback | Occurs during a drag operation. (Inherited from ToolStripItem.) |
![]() | GotFocus | Occurs when the hosted control receives focus. |
![]() | KeyDown | Occurs when a key is pressed and held down while the hosted control has focus. |
![]() | KeyPress | Occurs when a key is pressed while the hosted control has focus. |
![]() | KeyUp | Occurs when a key is released while the hosted control has focus. |
![]() | Leave | Occurs when the input focus leaves the hosted control. |
![]() | LocationChanged | Occurs when the location of a ToolStripItem is updated. (Inherited from ToolStripItem.) |
![]() | LostFocus | Occurs when the hosted control loses focus. |
![]() | MouseDown | Occurs when the mouse pointer is over the item and a mouse button is pressed. (Inherited from ToolStripItem.) |
![]() | MouseEnter | Occurs when the mouse pointer enters the item. (Inherited from ToolStripItem.) |
![]() | MouseHover | Occurs when the mouse pointer hovers over the item. (Inherited from ToolStripItem.) |
![]() | MouseLeave | Occurs when the mouse pointer leaves the item. (Inherited from ToolStripItem.) |
![]() | MouseMove | Occurs when the mouse pointer is moved over the item. (Inherited from ToolStripItem.) |
![]() | MouseUp | Occurs when the mouse pointer is over the item and a mouse button is released. (Inherited from ToolStripItem.) |
![]() | OwnerChanged | Occurs when the Owner property changes. (Inherited from ToolStripItem.) |
![]() | Paint | Occurs when the item is redrawn. (Inherited from ToolStripItem.) |
![]() | QueryAccessibilityHelp | Occurs when an accessibility client application invokes help for the ToolStripItem. (Inherited from ToolStripItem.) |
![]() | QueryContinueDrag | Occurs during a drag-and-drop operation and allows the drag source to determine whether the drag-and-drop operation should be canceled. (Inherited from ToolStripItem.) |
![]() | RightToLeftChanged | Occurs when the RightToLeft property value changes. (Inherited from ToolStripItem.) |
![]() | TextChanged | Occurs when the value of the Text property changes. (Inherited from ToolStripItem.) |
![]() | Validated | Occurs after the hosted control has been successfully validated. |
![]() | Validating | Occurs while the hosted control is validating. |
![]() | VisibleChanged | Occurs when the value of the Visible property changes. (Inherited from ToolStripItem.) |
| Name | Description | |
|---|---|---|
![]() ![]() | IDropTarget::OnDragDrop | Raises the DragDrop event. (Inherited from ToolStripItem.) |
![]() ![]() | IDropTarget::OnDragEnter | Raises the DragEnter event. (Inherited from ToolStripItem.) |
![]() ![]() | IDropTarget::OnDragLeave | Raises the DragLeave event. (Inherited from ToolStripItem.) |
![]() ![]() | IDropTarget::OnDragOver | Raises the DragOver event. (Inherited from ToolStripItem.) |
ToolStripControlHost is the abstract base class for ToolStripComboBox, ToolStripTextBox, and ToolStripProgressBar. ToolStripControlHost can host other controls, including custom controls, in two ways:
Construct a ToolStripControlHost with a class that derives from Control. To fully access the hosted control and properties, you must cast the Control property back to the actual class it represents.
Extend ToolStripControlHost, and in the inherited class's default constructor, call the base class constructor passing a class that derives from Control. This option lets you wrap common control methods and properties for easy access in a ToolStrip.
Use the ToolStripControlHost class to host your customized controls or any other Windows Forms control.
To customize a ToolStripItem, derive from ToolStripControlHost and create a custom implementation. You can override methods such as OnSubscribeControlEvents to handle events raised by the hosted controls, and you can put custom functionality into properties to enhance the hosted control.
The following code example demonstrates constructing a ToolStripControlHost with a MonthCalendar control, using OnSubscribeControlEvents to handle events, and exposing some of its members to the ToolStripControlHost.
//Declare a class that inherits from ToolStripControlHost. public ref class ToolStripMonthCalendar: public ToolStripControlHost { public: // Call the base constructor passing in a MonthCalendar instance. ToolStripMonthCalendar() : ToolStripControlHost( gcnew MonthCalendar ) {} property MonthCalendar^ MonthCalendarControl { MonthCalendar^ get() { return static_cast<MonthCalendar^>(Control); } } property Day FirstDayOfWeek { // Expose the MonthCalendar.FirstDayOfWeek as a property. Day get() { return MonthCalendarControl->FirstDayOfWeek; } void set( Day value ) { MonthCalendarControl->FirstDayOfWeek = value; } } // Expose the AddBoldedDate method. void AddBoldedDate( DateTime dateToBold ) { MonthCalendarControl->AddBoldedDate( dateToBold ); } protected: // Subscribe and unsubscribe the control events you wish to expose. void OnSubscribeControlEvents( System::Windows::Forms::Control^ c ) { // Call the base so the base events are connected. __super::OnSubscribeControlEvents( c ); // Cast the control to a MonthCalendar control. MonthCalendar^ monthCalendarControl = (MonthCalendar^)c; // Add the event. monthCalendarControl->DateChanged += gcnew DateRangeEventHandler( this, &ToolStripMonthCalendar::HandleDateChanged ); } void OnUnsubscribeControlEvents( System::Windows::Forms::Control^ c ) { // Call the base method so the basic events are unsubscribed. __super::OnUnsubscribeControlEvents( c ); // Cast the control to a MonthCalendar control. MonthCalendar^ monthCalendarControl = (MonthCalendar^)c; // Remove the event. monthCalendarControl->DateChanged -= gcnew DateRangeEventHandler( this, &ToolStripMonthCalendar::HandleDateChanged ); } public: event DateRangeEventHandler^ DateChanged; private: // Declare the DateChanged event. // Raise the DateChanged event. void HandleDateChanged( Object^ sender, DateRangeEventArgs^ e ) { if ( DateChanged != nullptr ) { DateChanged( this, e ); } } };
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
