Windows form menu strip
Create easily customized, commonly employed menus that support advanced user interface and layout features, such as text and image ordering and alignment, drag-and-drop operations, MDI, overflow, and alternate modes of accessing menu commands.
Handle events consistently for all containers and contained items, in the same way you handle events for other controls. The following table shows some particularly important properties of MenuStrip and associated classes. The following table shows the important MenuStrip companion classes. Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode. Please rate your experience Yes No. The classes that provide access to the metadata of the running program are available in the System.
Reflection namespace. Type is inherited: type. ToString ; Creating an instance of the form by Locating the specified type from the Assembly.
Entire code. SqlConnection conn;. MenuStrip MnuStrip;. InitializeComponent ;. View All. Dynamic MenuStrip in Windows Forms. Shankar M Updated date Feb 12, Open ; da. Fill dt ; foreach DataRow dr in dt. ToString ; MnuStrip. Fill dtchild ; foreach DataRow dr in dtchild. ExecutablePath ; foreach Type type in frmAssembly. Name ; if type.
Entire code using System; using System. Generic; using System. ComponentModel; using System. Data; using System. Drawing; using System. Linq; using System. Gets the spacing, in pixels, between the left, right, top, and bottom edges of the MenuStrip from the edges of the form.
Gets a value indicating whether ToolTips are shown for the MenuStrip by default. Gets the horizontal and vertical dimensions, in pixels, of the MenuStrip when it is first created. Gets a value that indicates whether the Component is currently in design mode. Gets the subset of items that are currently displayed on the ToolStrip , including items that are automatically added into the ToolStrip.
Gets a value indicating whether the base Control class is in the process of disposing. Gets or sets which ToolStrip borders are docked to its parent control and determines how a ToolStrip is resized with its parent.
Gets or sets a value indicating whether this control should redraw its surface using a secondary buffer to reduce or prevent flicker. Gets the list of event handlers that are attached to this Component. Gets or sets the foreground color of the ToolStrip. Gets the orientation of the ToolStrip move handle.
Gets or sets the space around the ToolStrip move handle. Gets the boundaries of the ToolStrip move handle. Gets or sets the image list that contains the image displayed on a ToolStrip item.
Gets or sets the size, in pixels, of an image used on a ToolStrip. Gets a value indicating whether the caller must call an invoke method when making method calls to the control because the caller is on a different thread than the one the control was created on. Indicates if one of the Ancestors of this control is sited and that site in DesignMode. This property is read-only. Gets a value indicating whether the user is currently moving the ToolStrip from one ToolStripContainer to another.
Gets all the items that belong to a ToolStrip. Passes a reference to the cached LayoutEngine returned by the layout engine interface. Gets or sets a value indicating how the ToolStrip lays out the items collection.
Gets or sets the distance, in pixels, between the left edge of the control and the left edge of its container's client area. Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container. Gets or sets the size that is the upper limit that GetPreferredSize Size can specify. Gets the maximum height and width, in pixels, of the ToolStrip. Gets or sets the size that is the lower limit that GetPreferredSize Size can specify.
Gets the orientation of the ToolStripPanel. Gets or sets a value that indicates which visual styles will be applied to the ToolStrip.
Gets the distance, in pixels, between the right edge of the control and the left edge of its container's client area. Gets or sets a value indicating whether control's elements are aligned to support locales using right-to-left fonts.
Gets or sets a value indicating whether ToolTips are shown for the MenuStrip. Gets a value indicating whether the user interface is in the appropriate state to show or hide keyboard accelerators. Gets or sets a value indicating whether the MenuStrip stretches from end to end in its container. Gets or sets a value indicating whether the user can give the focus to an item in the ToolStrip using the TAB key.
Gets or sets the direction in which to draw text on a ToolStrip. Gets or sets the distance, in pixels, between the top edge of the control and the top edge of its container's client area. Gets the parent control that is not parented by another Windows Forms control. Typically, this is the outermost Form that the control is contained in. Gets or sets a value indicating whether to use the wait cursor for the current control and all child controls.
Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control. Adjusts the scroll bars on the container based on the current control positions and the control currently selected.
Executes the specified delegate asynchronously on the thread that the control's underlying handle was created on. Executes the specified delegate asynchronously with the specified arguments, on the thread that the control's underlying handle was created on. Forces the creation of the visible control, including the creation of the handle and any visible child controls. Creates the Graphics for the control. Specifies the visual arrangement for the ToolStrip. Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
Releases all resources used by the Component. Releases the unmanaged resources used by the ToolStrip and optionally releases the managed resources. Retrieves the return value of the asynchronous operation represented by the IAsyncResult passed.
Retrieves the specified AccessibleObject. Retrieves a value indicating how a control will behave when its AutoSize property is enabled. Returns the next ContainerControl up the control's chain of parent controls.
Returns the item located at the specified x- and y-coordinates of the ToolStrip client area. Returns the item located at the specified point in the client area of the ToolStrip. Retrieves the current lifetime service object that controls the lifetime policy for this instance. Retrieves the next ToolStripItem from the specified reference point and moving in the specified direction.
Returns an object that represents a service provided by the Component or by its Container. Gets the Type of the current instance. Invalidates a specific region of the control and causes a paint message to be sent to the control. Optionally, invalidates the child controls assigned to the control. Invalidates the specified region of the control adds it to the control's update region, which is the area that will be repainted at the next paint operation , and causes a paint message to be sent to the control.
Executes the specified delegate, on the thread that owns the control's underlying window handle, with the specified list of arguments. Raises the GotFocus event for the specified control. Raises the LostFocus event for the specified control. Raises the Click event for the specified control.
Raises the Paint event for the specified control. Raises the PaintBackground event for the specified control. Determines whether the specified key is a regular input key or a special key that requires preprocessing. Transforms a size from logical to device units by scaling it for the current DPI and rounding down to the nearest integer value for width and height. Creates a shallow copy of the current Object. Creates a shallow copy of the current MarshalByRefObject object.
Raises the Invalidated event with a specified region of the control to invalidate. Raises the AutoSizeChanged event.
Raises the BackColorChanged event. Raises the BackgroundImageChanged event. Raises the BackgroundImageLayoutChanged event. Raises the BeginDrag event. Raises the BindingContextChanged event. Raises the CausesValidationChanged event. Raises the ChangeUICues event. Raises the Click event. Raises the ClientSizeChanged event. Raises the ContextMenuChanged event. Raises the ContextMenuStripChanged event. Raises the ControlAdded event. Raises the ControlRemoved event. Raises the CreateControl method.
Raises the CursorChanged event. Raises the DockChanged event. Raises the DoubleClick event. Raises the DpiChangedAfterParent event. Raises the DpiChangedBeforeParent event. Raises the DragDrop event. Raises the DragEnter event. Raises the DragLeave event. Raises the DragOver event.
Raises the Enabled event. Raises the EndDrag event. Raises the Enter event. Raises the FontChanged event. Raises the ForeColorChanged event. Raises the GiveFeedback event. Raises the GotFocus event. Raises the HandleCreated event. Raises the HandleDestroyed event. Raises the HelpRequested event. Raises the ImeModeChanged event. Raises the Invalidated event. Raises the ItemAdded event. Raises the ItemClicked event.
Raises the ItemRemoved event. Raises the KeyDown event. Raises the KeyPress event. Raises the KeyUp event. Raises the Layout event. Raises the LayoutCompleted event. Raises the LayoutStyleChanged event.
Raises the Leave event. Raises the LocationChanged event. Raises the LostFocus event. Raises the MarginChanged event. Raises the MenuActivate event. Raises the MenuDeactivate event. Raises the MouseCaptureChanged event. Raises the MouseClick event. Raises the MouseDoubleClick event. Raises the MouseDown event. Raises the MouseEnter event.
Raises the MouseHover event. Raises the MouseLeave event. Raises the MouseMove event. Raises the MouseUp event. Raises the MouseWheel event. Raises the Move event. Raises the PaddingChanged event. Raises the Paint event. Raises the Paint event for the ToolStrip background. Raises the PaintGrip event. Raises the BackColorChanged event when the BackColor property value of the control's container changes.
Raises the BackgroundImageChanged event when the BackgroundImage property value of the control's container changes. Raises the BindingContextChanged event when the BindingContext property value of the control's container changes. Raises the ParentChanged event. Raises the EnabledChanged event when the Enabled property value of the control's container changes. Raises the FontChanged event when the Font property value of the control's container changes.
Raises the ForeColorChanged event when the ForeColor property value of the control's container changes. Raises the VisibleChanged event when the Visible property value of the control's container changes. Raises the PreviewKeyDown event. Raises the QueryContinueDrag event. Raises the RegionChanged event. Raises the RendererChanged event. Raises the Resize event. Raises the RightToLeftChanged event. Raises the Scroll event.
Raises the SizeChanged event. Raises the StyleChanged event. Raises the SystemColorsChanged event. Raises the TabIndexChanged event. Raises the TabStopChanged event. Raises the TextChanged event. Raises the Validated event. Raises the Validating event. Raises the VisibleChanged event. Forces the control to invalidate its client area and immediately redraw itself and any child controls. When overridden in a derived class, handles the rescaling of any magic numbers that are used in control painting.
Resets the BackColor property to its default value. Causes a control bound to the BindingSource to reread all the items in the list and refresh their displayed values. Resets the Cursor property to its default value.
Resets the Font property to its default value. Resets the ForeColor property to its default value. Resets the ImeMode property to its default value. Resets the control to handle the MouseLeave event. Resets the RightToLeft property to its default value. Resets the Text property to its default value Empty. Converts the specified ContentAlignment to the appropriate ContentAlignment to support right-to-left text.
Converts the specified HorizontalAlignment to the appropriate HorizontalAlignment to support right-to-left text. Activates a child control. Optionally specifies the direction in the tab order to select the control from.
Sets a value indicating how a control will behave when its AutoSize property is enabled. Sets a specified ControlStyles flag to either true or false. Retrieves a value that sets the ToolStripItem to the specified visibility state. Returns a string that represents the ToolStrip control. Occurs when the AutoSize property has changed.
Occurs when the value of the BackColor property changes.
0コメント