ToolStripDropDownItem 类

定义

提供当单击 ToolStripDropDownToolStripDropDownButtonToolStripMenuItem 控件时,显示 ToolStripSplitButton 的控件的基本功能。

public ref class ToolStripDropDownItem abstract : System::Windows::Forms::ToolStripItem
public abstract class ToolStripDropDownItem : System.Windows.Forms.ToolStripItem
type ToolStripDropDownItem = class
    inherit ToolStripItem
Public MustInherit Class ToolStripDropDownItem
Inherits ToolStripItem
继承
继承
派生

示例

下面的代码示例演示如何显示和隐藏 ToolStripMenuItem 控件。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace ToolStripDropDownItemCS
{
    public class Form1 : Form
    {
        private ToolStrip toolStrip1;
        private StatusStrip statusStrip1;
        private ToolStripStatusLabel toolStripStatusLabel1;
        private ContextMenuStrip contextMenuStrip1;
        private ToolStripMenuItem menuItem1ToolStripMenuItem;
        private ToolStripMenuItem menuItem2ToolStripMenuItem;
        private ToolStripMenuItem subItemToolStripMenuItem;
        private ToolStripMenuItem subItem2ToolStripMenuItem;
        private Button showButton;
        private Button hideButton;
        private System.ComponentModel.IContainer components = null;

        public Form1()
        {
            InitializeComponent();
            this.InitializeToolStripDropDownItems();
        }

        // This utility method creates and initializes three 
        // ToolStripDropDownItem controls and adds them 
        // to the form's ToolStrip control.
        private void InitializeToolStripDropDownItems()
        {
            ToolStripDropDownButton b = new ToolStripDropDownButton("DropDownButton");
            b.DropDown = this.contextMenuStrip1;
            b.DropDownClosed += new EventHandler(toolStripDropDownItem_DropDownClosed);
            b.DropDownItemClicked += new ToolStripItemClickedEventHandler(toolStripDropDownItem_DropDownItemClicked);
            b.DropDownOpened += new EventHandler(toolStripDropDownItem_DropDownOpened);

            ToolStripMenuItem m = new ToolStripMenuItem("MenuItem");
            m.DropDown = this.contextMenuStrip1;
            m.DropDownClosed += new EventHandler(toolStripDropDownItem_DropDownClosed);
            m.DropDownItemClicked += new ToolStripItemClickedEventHandler(toolStripDropDownItem_DropDownItemClicked);
            m.DropDownOpened += new EventHandler(toolStripDropDownItem_DropDownOpened);

            ToolStripSplitButton sb = new ToolStripSplitButton("SplitButton");
            sb.DropDown = this.contextMenuStrip1;
            sb.DropDownClosed += new EventHandler(toolStripDropDownItem_DropDownClosed);
            sb.DropDownItemClicked += new ToolStripItemClickedEventHandler(toolStripDropDownItem_DropDownItemClicked);
            sb.DropDownOpened += new EventHandler(toolStripDropDownItem_DropDownOpened);

            this.toolStrip1.Items.AddRange(new ToolStripItem[] { b, m, sb });
        }

        // This method handles the DropDownOpened event from a 
        // ToolStripDropDownItem. It displays the value of the 
        // item's Text property in the form's StatusStrip control.
        void toolStripDropDownItem_DropDownOpened(object sender, EventArgs e)
        {
            ToolStripDropDownItem item = sender as ToolStripDropDownItem;

            string msg = String.Format("Item opened: {0}", item.Text);
            this.toolStripStatusLabel1.Text = msg;
        }

        // This method handles the DropDownItemClicked event from a 
        // ToolStripDropDownItem. It displays the value of the clicked
        // item's Text property in the form's StatusStrip control.
        void toolStripDropDownItem_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            string msg = String.Format("Item clicked: {0}", e.ClickedItem.Text);
            this.toolStripStatusLabel1.Text = msg;
        }

        // This method handles the DropDownClosed event from a 
        // ToolStripDropDownItem. It displays the value of the 
        // item's Text property in the form's StatusStrip control.
        void toolStripDropDownItem_DropDownClosed(object sender, EventArgs e)
        {
            ToolStripDropDownItem item = sender as ToolStripDropDownItem;

            string msg = String.Format("Item closed: {0}", item.Text);
            this.toolStripStatusLabel1.Text = msg;
        }

        // This method shows the drop-down for the first item
        // in the form's ToolStrip.
        private void showButton_Click(object sender, EventArgs e)
        {
            ToolStripDropDownItem item = this.toolStrip1.Items[0] as ToolStripDropDownItem;

            if (item.HasDropDownItems)
            {
                item.ShowDropDown();
            }
        }

        // This method hides the drop-down for the first item
        // in the form's ToolStrip.
        private void hideButton_Click(object sender, EventArgs e)
        {
            ToolStripDropDownItem item = this.toolStrip1.Items[0] as ToolStripDropDownItem;

            item.HideDropDown();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.toolStrip1 = new System.Windows.Forms.ToolStrip();
            this.statusStrip1 = new System.Windows.Forms.StatusStrip();
            this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.menuItem1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.menuItem2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.subItemToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.subItem2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.showButton = new System.Windows.Forms.Button();
            this.hideButton = new System.Windows.Forms.Button();
            this.statusStrip1.SuspendLayout();
            this.contextMenuStrip1.SuspendLayout();
            this.SuspendLayout();
            // 
            // toolStrip1
            // 
            this.toolStrip1.Location = new System.Drawing.Point(0, 0);
            this.toolStrip1.Name = "toolStrip1";
            this.toolStrip1.Size = new System.Drawing.Size(292, 25);
            this.toolStrip1.TabIndex = 0;
            this.toolStrip1.Text = "toolStrip1";
            // 
            // statusStrip1
            // 
            this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.toolStripStatusLabel1});
            this.statusStrip1.Location = new System.Drawing.Point(0, 251);
            this.statusStrip1.Name = "statusStrip1";
            this.statusStrip1.Size = new System.Drawing.Size(292, 22);
            this.statusStrip1.TabIndex = 1;
            this.statusStrip1.Text = "statusStrip1";
            // 
            // toolStripStatusLabel1
            // 
            this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
            this.toolStripStatusLabel1.Size = new System.Drawing.Size(38, 17);
            this.toolStripStatusLabel1.Text = "Ready";
            // 
            // contextMenuStrip1
            // 
            this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.menuItem1ToolStripMenuItem,
            this.menuItem2ToolStripMenuItem});
            this.contextMenuStrip1.Name = "contextMenuStrip1";
            this.contextMenuStrip1.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.contextMenuStrip1.Size = new System.Drawing.Size(146, 48);
            // 
            // menuItem1ToolStripMenuItem
            // 
            this.menuItem1ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.subItemToolStripMenuItem});
            this.menuItem1ToolStripMenuItem.Name = "menuItem1ToolStripMenuItem";
            this.menuItem1ToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
            this.menuItem1ToolStripMenuItem.Text = "Menu Item1";
            // 
            // menuItem2ToolStripMenuItem
            // 
            this.menuItem2ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.subItem2ToolStripMenuItem});
            this.menuItem2ToolStripMenuItem.Name = "menuItem2ToolStripMenuItem";
            this.menuItem2ToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
            this.menuItem2ToolStripMenuItem.Text = "Menu Item 2";
            // 
            // subItemToolStripMenuItem
            // 
            this.subItemToolStripMenuItem.Name = "subItemToolStripMenuItem";
            this.subItemToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
            this.subItemToolStripMenuItem.Text = "Sub Item";
            // 
            // subItem2ToolStripMenuItem
            // 
            this.subItem2ToolStripMenuItem.Name = "subItem2ToolStripMenuItem";
            this.subItem2ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
            this.subItem2ToolStripMenuItem.Text = "Sub Item2";
            // 
            // showButton
            // 
            this.showButton.Location = new System.Drawing.Point(12, 180);
            this.showButton.Name = "showButton";
            this.showButton.Size = new System.Drawing.Size(75, 23);
            this.showButton.TabIndex = 2;
            this.showButton.Text = "Show";
            this.showButton.UseVisualStyleBackColor = true;
            this.showButton.Click += new System.EventHandler(this.showButton_Click);
            // 
            // hideButton
            // 
            this.hideButton.Location = new System.Drawing.Point(12, 209);
            this.hideButton.Name = "hideButton";
            this.hideButton.Size = new System.Drawing.Size(75, 23);
            this.hideButton.TabIndex = 3;
            this.hideButton.Text = "Hide";
            this.hideButton.UseVisualStyleBackColor = true;
            this.hideButton.Click += new System.EventHandler(this.hideButton_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(292, 273);
            this.Controls.Add(this.statusStrip1);
            this.Controls.Add(this.hideButton);
            this.Controls.Add(this.toolStrip1);
            this.Controls.Add(this.showButton);
            this.Name = "Form1";
            this.Text = "Form1";
            this.statusStrip1.ResumeLayout(false);
            this.statusStrip1.PerformLayout();
            this.contextMenuStrip1.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        #endregion
    }

    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms

Public Class Form1
   Inherits Form
   Private toolStrip1 As ToolStrip
   Private statusStrip1 As StatusStrip
   Private toolStripStatusLabel1 As ToolStripStatusLabel
   Private contextMenuStrip1 As ContextMenuStrip
   Private menuItem1ToolStripMenuItem As ToolStripMenuItem
   Private menuItem2ToolStripMenuItem As ToolStripMenuItem
   Private subItemToolStripMenuItem As ToolStripMenuItem
   Private subItem2ToolStripMenuItem As ToolStripMenuItem
   Private WithEvents showButton As Button
   Private WithEvents hideButton As Button
   Private components As System.ComponentModel.IContainer = Nothing
   
   
   Public Sub New()
      InitializeComponent()
      Me.InitializeToolStripDropDownItems()
    End Sub
   
   ' This utility method creates and initializes three 
   ' ToolStripDropDownItem controls and adds them 
   ' to the form's ToolStrip control.
   Private Sub InitializeToolStripDropDownItems()
      Dim b As New ToolStripDropDownButton("DropDownButton")
      b.DropDown = Me.contextMenuStrip1
      AddHandler b.DropDownClosed, AddressOf toolStripDropDownItem_DropDownClosed
      AddHandler b.DropDownItemClicked, AddressOf toolStripDropDownItem_DropDownItemClicked
      AddHandler b.DropDownOpened, AddressOf toolStripDropDownItem_DropDownOpened
      
      Dim m As New ToolStripMenuItem("MenuItem")
      m.DropDown = Me.contextMenuStrip1
      AddHandler m.DropDownClosed, AddressOf toolStripDropDownItem_DropDownClosed
      AddHandler m.DropDownItemClicked, AddressOf toolStripDropDownItem_DropDownItemClicked
      AddHandler m.DropDownOpened, AddressOf toolStripDropDownItem_DropDownOpened
      
      Dim sb As New ToolStripSplitButton("SplitButton")
      sb.DropDown = Me.contextMenuStrip1
      AddHandler sb.DropDownClosed, AddressOf toolStripDropDownItem_DropDownClosed
      AddHandler sb.DropDownItemClicked, AddressOf toolStripDropDownItem_DropDownItemClicked
      AddHandler sb.DropDownOpened, AddressOf toolStripDropDownItem_DropDownOpened
      
      Me.toolStrip1.Items.AddRange(New ToolStripItem() {b, m, sb})
   End Sub 

   ' This method handles the DropDownOpened event from a 
   ' ToolStripDropDownItem. It displays the value of the 
   ' item's Text property in the form's StatusStrip control.
    Private Sub toolStripDropDownItem_DropDownOpened(ByVal sender As Object, ByVal e As EventArgs)

        Dim item As ToolStripDropDownItem = CType(sender, ToolStripDropDownItem)

        Dim msg As String = String.Format("Item opened: {0}", item.Text)
        Me.toolStripStatusLabel1.Text = msg

    End Sub

   ' This method handles the DropDownItemClicked event from a 
   ' ToolStripDropDownItem. It displays the value of the clicked
   ' item's Text property in the form's StatusStrip control.
    Private Sub toolStripDropDownItem_DropDownItemClicked( _
    ByVal sender As Object, _
    ByVal e As ToolStripItemClickedEventArgs)

        Dim msg As String = String.Format("Item clicked: {0}", e.ClickedItem.Text)
        Me.toolStripStatusLabel1.Text = msg

    End Sub

   ' This method handles the DropDownClosed event from a 
   ' ToolStripDropDownItem. It displays the value of the 
   ' item's Text property in the form's StatusStrip control.
    Private Sub toolStripDropDownItem_DropDownClosed(ByVal sender As Object, ByVal e As EventArgs)

        Dim item As ToolStripDropDownItem = CType(sender, ToolStripDropDownItem)

        Dim msg As String = String.Format("Item closed: {0}", item.Text)
        Me.toolStripStatusLabel1.Text = msg

    End Sub

   ' This method shows the drop-down for the first item
   ' in the form's ToolStrip.
    Private Sub showButton_Click( _
    ByVal sender As Object, _
    ByVal e As EventArgs) _
    Handles showButton.Click

        Dim item As ToolStripDropDownItem = CType(Me.toolStrip1.Items(0), ToolStripDropDownItem)

        If item.HasDropDownItems Then
            item.ShowDropDown()
        End If

    End Sub

   ' This method hides the drop-down for the first item
   ' in the form's ToolStrip.
    Private Sub hideButton_Click( _
    ByVal sender As Object, _
    ByVal e As EventArgs) _
    Handles hideButton.Click

        Dim item As ToolStripDropDownItem = CType(Me.toolStrip1.Items(0), ToolStripDropDownItem)

        item.HideDropDown()
    End Sub

   Protected Overrides Sub Dispose(disposing As Boolean)
      If disposing AndAlso (components IsNot Nothing) Then
         components.Dispose()
      End If
      MyBase.Dispose(disposing)
    End Sub
   
   #Region "Windows Form Designer generated code"
   
   
   Private Sub InitializeComponent()
      Me.components = New System.ComponentModel.Container()
      Me.toolStrip1 = New System.Windows.Forms.ToolStrip()
      Me.statusStrip1 = New System.Windows.Forms.StatusStrip()
      Me.toolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel()
      Me.contextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
      Me.menuItem1ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
      Me.menuItem2ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
      Me.subItemToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
      Me.subItem2ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
      Me.showButton = New System.Windows.Forms.Button()
      Me.hideButton = New System.Windows.Forms.Button()
      Me.statusStrip1.SuspendLayout()
      Me.contextMenuStrip1.SuspendLayout()
      Me.SuspendLayout()
      ' 
      ' toolStrip1
      ' 
      Me.toolStrip1.Location = New System.Drawing.Point(0, 0)
      Me.toolStrip1.Name = "toolStrip1"
      Me.toolStrip1.Size = New System.Drawing.Size(292, 25)
      Me.toolStrip1.TabIndex = 0
      Me.toolStrip1.Text = "toolStrip1"
      ' 
      ' statusStrip1
      ' 
      Me.statusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripStatusLabel1})
      Me.statusStrip1.Location = New System.Drawing.Point(0, 251)
      Me.statusStrip1.Name = "statusStrip1"
      Me.statusStrip1.Size = New System.Drawing.Size(292, 22)
      Me.statusStrip1.TabIndex = 1
      Me.statusStrip1.Text = "statusStrip1"
      ' 
      ' toolStripStatusLabel1
      ' 
      Me.toolStripStatusLabel1.Name = "toolStripStatusLabel1"
      Me.toolStripStatusLabel1.Size = New System.Drawing.Size(38, 17)
      Me.toolStripStatusLabel1.Text = "Ready"
      ' 
      ' contextMenuStrip1
      ' 
      Me.contextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.menuItem1ToolStripMenuItem, Me.menuItem2ToolStripMenuItem})
      Me.contextMenuStrip1.Name = "contextMenuStrip1"
      Me.contextMenuStrip1.RightToLeft = System.Windows.Forms.RightToLeft.No
      Me.contextMenuStrip1.Size = New System.Drawing.Size(146, 48)
      ' 
      ' menuItem1ToolStripMenuItem
      ' 
      Me.menuItem1ToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.subItemToolStripMenuItem})
      Me.menuItem1ToolStripMenuItem.Name = "menuItem1ToolStripMenuItem"
      Me.menuItem1ToolStripMenuItem.Size = New System.Drawing.Size(145, 22)
      Me.menuItem1ToolStripMenuItem.Text = "Menu Item1"
      ' 
      ' menuItem2ToolStripMenuItem
      ' 
      Me.menuItem2ToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.subItem2ToolStripMenuItem})
      Me.menuItem2ToolStripMenuItem.Name = "menuItem2ToolStripMenuItem"
      Me.menuItem2ToolStripMenuItem.Size = New System.Drawing.Size(145, 22)
      Me.menuItem2ToolStripMenuItem.Text = "Menu Item 2"
      ' 
      ' subItemToolStripMenuItem
      ' 
      Me.subItemToolStripMenuItem.Name = "subItemToolStripMenuItem"
      Me.subItemToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
      Me.subItemToolStripMenuItem.Text = "Sub Item"
      ' 
      ' subItem2ToolStripMenuItem
      ' 
      Me.subItem2ToolStripMenuItem.Name = "subItem2ToolStripMenuItem"
      Me.subItem2ToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
      Me.subItem2ToolStripMenuItem.Text = "Sub Item2"
      ' 
      ' showButton
      ' 
      Me.showButton.Location = New System.Drawing.Point(12, 180)
      Me.showButton.Name = "showButton"
      Me.showButton.Size = New System.Drawing.Size(75, 23)
      Me.showButton.TabIndex = 2
      Me.showButton.Text = "Show"
      Me.showButton.UseVisualStyleBackColor = True
      ' 
      ' hideButton
      ' 
      Me.hideButton.Location = New System.Drawing.Point(12, 209)
      Me.hideButton.Name = "hideButton"
      Me.hideButton.Size = New System.Drawing.Size(75, 23)
      Me.hideButton.TabIndex = 3
      Me.hideButton.Text = "Hide"
      Me.hideButton.UseVisualStyleBackColor = True
      ' 
      ' Form1
      ' 
      Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
      Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
      Me.ClientSize = New System.Drawing.Size(292, 273)
      Me.Controls.Add(statusStrip1)
      Me.Controls.Add(hideButton)
      Me.Controls.Add(toolStrip1)
      Me.Controls.Add(showButton)
      Me.Name = "Form1"
      Me.Text = "Form1"
      Me.statusStrip1.ResumeLayout(False)
      Me.statusStrip1.PerformLayout()
      Me.contextMenuStrip1.ResumeLayout(False)
      Me.ResumeLayout(False)
      Me.PerformLayout()
    End Sub
   
   #End Region
End Class


Public Class Program

    ' The main entry point for the application.
    <STAThread()> _
    Shared Sub Main()
        Application.EnableVisualStyles()
        Application.SetCompatibleTextRenderingDefault(False)
        Application.Run(New Form1())
    End Sub
End Class

注解

ToolStripDropDownItemToolStripMenuItemToolStripDropDownButtonToolStripSplitButton 的抽象基类,可以直接承载项,也可以在下拉容器中承载其他项。 为此,可将 DropDown 属性设置为 ToolStripDropDown,并设置 ToolStripDropDownItems 属性。 可通过 DropDownItems 属性直接访问这些下拉项。

构造函数

ToolStripDropDownItem()

初始化 ToolStripDropDownItem 类的新实例。

ToolStripDropDownItem(String, Image, EventHandler)

使用指定的显示文本、图像和当单击下拉控件时要执行的操作来初始化 ToolStripDropDownItem 类的新实例。

ToolStripDropDownItem(String, Image, EventHandler, String)

使用指定的显示文本、图像、当单击下拉控件时要执行的操作以及控件名称来初始化 ToolStripDropDownItem 类的新实例。

ToolStripDropDownItem(String, Image, ToolStripItem[])

使用指定的显示文本、图像和下拉控件所包含的 ToolStripDropDownItem 集合来初始化 ToolStripItem 类的新实例。

属性

AccessibilityObject

获取分配给该控件的 AccessibleObject

(继承自 ToolStripItem)
AccessibleDefaultActionDescription

获取或设置控件的默认操作说明以供具有辅助功能的客户端应用程序使用。

(继承自 ToolStripItem)
AccessibleDescription

获取或设置将报告给具有辅助功能的客户端应用程序的说明。

(继承自 ToolStripItem)
AccessibleName

获取或设置供具有辅助功能的客户端应用程序使用的控件的名称。

(继承自 ToolStripItem)
AccessibleRole

获取或设置控件的辅助性角色,该角色指定控件的用户界面元素的类型。

(继承自 ToolStripItem)
Alignment

获取或设置一个值,该值指示该项是否与 ToolStrip 的起始或结尾处对齐。

(继承自 ToolStripItem)
AllowDrop

获取或设置一个值,该值指示是否通过你实现的事件来处理拖放和项重新排序。

(继承自 ToolStripItem)
Anchor

获取或设置 ToolStripItem 要绑定到的容器的边缘,并确定 ToolStripItem 如何随其父级调整大小。

(继承自 ToolStripItem)
AutoSize

获取或设置一个值,该值指示是否自动调整项的大小。

(继承自 ToolStripItem)
AutoToolTip

获取或设置一个值,该值指示对 ToolTipText 工具提示使用 Text 属性还是 ToolStripItem 属性。

(继承自 ToolStripItem)
Available

获取或设置一个值,该值指示是否应该将 ToolStripItem 放置在 ToolStrip 上。

(继承自 ToolStripItem)
BackColor

获取或设置项的背景色。

(继承自 ToolStripItem)
BackgroundImage

获取或设置在项中显示的背景图像。

(继承自 ToolStripItem)
BackgroundImageLayout

获取或设置用于 ToolStripItem 的背景图像布局。

(继承自 ToolStripItem)
BindingContext

获取或设置 IBindableComponent 的货币管理器的集合。

(继承自 BindableComponent)
Bounds

获取项的大小和位置。

(继承自 ToolStripItem)
CanRaiseEvents

获取一个指示组件是否可以引发事件的值。

(继承自 Component)
CanSelect

获取一个值,该值指示能否选择该项。

(继承自 ToolStripItem)
Command

获取或设置在 ICommand 调用 ToolStripItem 的 事件时将调用其 Execute(Object) 方法的 Click

(继承自 ToolStripItem)
CommandParameter

获取或设置传递给 ICommand 分配给 Command 属性的 的参数。

(继承自 ToolStripItem)
Container

获取包含 IContainerComponent

(继承自 Component)
ContentRectangle

获取在不覆盖背景边框的情况下,可以将内容(如文本和图标)放置在 ToolStripItem 内的哪个区域。

(继承自 ToolStripItem)
DataBindings

获取此 IBindableComponent 的数据绑定对象的集合。

(继承自 BindableComponent)
DefaultAutoToolTip

获取一个值,该值指示是否显示定义为默认值的 ToolTip

(继承自 ToolStripItem)
DefaultDisplayStyle

获取一个值,该值指示在 ToolStripItem 上显示的内容。

(继承自 ToolStripItem)
DefaultMargin

获取项的默认边距。

(继承自 ToolStripItem)
DefaultPadding

获取项的内部间距特征。

(继承自 ToolStripItem)
DefaultSize

获取项的默认大小。

(继承自 ToolStripItem)
DesignMode

获取一个值,用以指示 Component 当前是否处于设计模式。

(继承自 Component)
DismissWhenClicked

获取一个值,该值指示在单击 ToolStripDropDown 上的项后是否隐藏这些项。

(继承自 ToolStripItem)
DisplayStyle

获取或设置是否在 ToolStripItem 上显示文本和图像。

(继承自 ToolStripItem)
Dock

获取或设置要停靠在其父控件上的 ToolStripItem 边框,并确定 ToolStripItem 如何随其父控件一起调整大小。

(继承自 ToolStripItem)
DoubleClickEnabled

获取或设置一个值,该值指示通过双击鼠标能否激活 ToolStripItem

(继承自 ToolStripItem)
DropDown

获取或设置单击此 ToolStripDropDown 时将显示的 ToolStripDropDownItem

DropDownDirection

获取或设置一个值,该值指示 ToolStripDropDownItem 从其父容器出现的方向。

DropDownItems

获取与此 ToolStripDropDown 关联的 ToolStripDropDownItem 中的项的集合。

DropDownLocation

获取 ToolStripDropDownItem 左上角的屏幕坐标(以像素为单位)。

Enabled

获取或设置一个值,该值指示是否启用了 ToolStripItem 的父控件。

(继承自 ToolStripItem)
Events

获取附加到此 Component 的事件处理程序的列表。

(继承自 Component)
Font

获取或设置由该项显示的文本的字体。

(继承自 ToolStripItem)
ForeColor

获取或设置项的前景色。

(继承自 ToolStripItem)
HasDropDown

获取或设置一个值,该值指示否已创建 DropDownToolStripDropDownItem

HasDropDownItems

获取一个值,该值指示 ToolStripDropDownItem 是否有 ToolStripDropDown 控件与它关联。

Height

获取或设置 ToolStripItem 的高度(以像素为单位)。

(继承自 ToolStripItem)
Image

获取或设置显示在 ToolStripItem 上的图像。

(继承自 ToolStripItem)
ImageAlign

获取或设置 ToolStripItem 上的图像对齐方式。

(继承自 ToolStripItem)
ImageIndex

获取或设置在该项上显示的图像的索引值。

(继承自 ToolStripItem)
ImageKey

获取或设置显示在 ImageList 上的 ToolStripItem 中图像的键访问器。

(继承自 ToolStripItem)
ImageScaling

获取或设置一个值,该值指示是否根据容器自动调整 ToolStripItem 上图像的大小。

(继承自 ToolStripItem)
ImageTransparentColor

获取或设置 ToolStripItem 图像中被视为透明的颜色。

(继承自 ToolStripItem)
IsDisposed

获取一个值,该值指示对象是否已被释放。

(继承自 ToolStripItem)
IsOnDropDown

获取一个值,该值指示当前 Control 的容器是否是 ToolStripDropDown

(继承自 ToolStripItem)
IsOnOverflow

获取一个值,该值指示 Placement 属性是否设置为 Overflow

(继承自 ToolStripItem)
Margin

获取或设置项与相邻项之间的间距。

(继承自 ToolStripItem)
MergeAction

获取或设置如何将子菜单与父菜单合并。

(继承自 ToolStripItem)
MergeIndex

获取或设置合并的项在当前 ToolStrip 内的位置。

(继承自 ToolStripItem)
Name

获取或设置项的名称。

(继承自 ToolStripItem)
Overflow

获取或设置该项应附加到 ToolStripToolStripOverflowButton,还是漂浮在两者之间。

(继承自 ToolStripItem)
Owner

获取或设置此项的所有者。

(继承自 ToolStripItem)
OwnerItem

获取此 ToolStripItem 的父级 ToolStripItem

(继承自 ToolStripItem)
Padding

获取或设置项的内容与其边缘之间的内部间距(以像素为单位)。

(继承自 ToolStripItem)
Parent

获取或设置 ToolStripItem 的父容器。

(继承自 ToolStripItem)
Placement

获取项的当前布局。

(继承自 ToolStripItem)
Pressed

获取一个值,该值指示 ToolStripDropDownItem 是否处于按下状态。

RightToLeft

获取或设置一个值,该值指示项的放置顺序和文本的写入顺序是否均为从右向左。

(继承自 ToolStripItem)
RightToLeftAutoMirrorImage

ToolStripItem 属性设置为 RightToLeft 时,将自动镜像 Yes 图像。

(继承自 ToolStripItem)
Selected

获取一个值,该值指示该项是否处于选定状态。

(继承自 ToolStripItem)
ShowKeyboardCues

获取一个值,该值指示是显示还是隐藏快捷键。

(继承自 ToolStripItem)
Site

获取或设置 ComponentISite

(继承自 Component)
Size

获取或设置项的大小。

(继承自 ToolStripItem)
Tag

获取或设置包含与项有关的数据的对象。

(继承自 ToolStripItem)
Text

获取或设置要显示在项上的文本。

(继承自 ToolStripItem)
TextAlign

获取或设置 ToolStripLabel 上的文本的对齐方式。

(继承自 ToolStripItem)
TextDirection

获取 ToolStripItem 上所用文本的方向。

(继承自 ToolStripItem)
TextImageRelation

获取或设置 ToolStripItem 文本和图像相对于彼此的位置。

(继承自 ToolStripItem)
ToolTipText

获取或设置作为控件的 ToolTip 显示的文本。

(继承自 ToolStripItem)
Visible

获取或设置一个值,该值指示是否显示该项。

(继承自 ToolStripItem)
Width

获取或设置 ToolStripItem 的宽度(以像素为单位)。

(继承自 ToolStripItem)

方法

CreateAccessibilityInstance()

ToolStripItem 创建一个新的辅助功能对象。

CreateDefaultDropDown()

创建可以为其定义事件的泛型 ToolStripDropDown

CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。

(继承自 MarshalByRefObject)
Dispose()

释放由 Component 使用的所有资源。

(继承自 Component)
Dispose(Boolean)

释放由 ToolStripDropDownItem 占用的非托管资源,还可以另外再释放托管资源。

DoDragDrop(Object, DragDropEffects)

开始拖放操作。

(继承自 ToolStripItem)
DoDragDrop(Object, DragDropEffects, Bitmap, Point, Boolean)

开始拖动操作。

(继承自 ToolStripItem)
Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetCurrentParent()

检索作为当前 ToolStrip 的容器的 ToolStripItem

(继承自 ToolStripItem)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetLifetimeService()
已过时.

检索控制此实例的生存期策略的当前生存期服务对象。

(继承自 MarshalByRefObject)
GetPreferredSize(Size)

检索可以容纳控件的矩形区域的大小。

(继承自 ToolStripItem)
GetService(Type)

返回一个对象,该对象表示由 Component 或它的 Container 提供的服务。

(继承自 Component)
GetType()

获取当前实例的 Type

(继承自 Object)
HideDropDown()

使可见的 ToolStripDropDown 隐藏。

InitializeLifetimeService()
已过时.

获取生存期服务对象来控制此实例的生存期策略。

(继承自 MarshalByRefObject)
Invalidate()

使 ToolStripItem 的整个图面无效并导致重绘该图面。

(继承自 ToolStripItem)
Invalidate(Rectangle)

通过将 ToolStripItem 的指定区域添加到 ToolStripItem 的更新区域(即下次执行绘制操作时将重新绘制的区域)使该指定区域无效,并导致向 ToolStripItem 发送绘制消息。

(继承自 ToolStripItem)
IsInputChar(Char)

确定字符是否为该项可识别的输入字符。

(继承自 ToolStripItem)
IsInputKey(Keys)

确定指定的键是常规输入键还是需要预处理的特殊键。

(继承自 ToolStripItem)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。

(继承自 MarshalByRefObject)
OnAvailableChanged(EventArgs)

引发 AvailableChanged 事件。

(继承自 ToolStripItem)
OnBackColorChanged(EventArgs)

引发 BackColorChanged 事件。

(继承自 ToolStripItem)
OnBindingContextChanged(EventArgs)

引发 BindingContextChanged 事件。

(继承自 BindableComponent)
OnBoundsChanged()

Bounds 属性更改时发生。

OnClick(EventArgs)

引发 Click 事件。

(继承自 ToolStripItem)
OnCommandCanExecuteChanged(EventArgs)

引发 CommandCanExecuteChanged 事件。

(继承自 ToolStripItem)
OnCommandChanged(EventArgs)

引发 CommandChanged 事件。

(继承自 ToolStripItem)
OnCommandParameterChanged(EventArgs)

引发 CommandParameterChanged 事件。

(继承自 ToolStripItem)
OnDisplayStyleChanged(EventArgs)

引发 DisplayStyleChanged 事件。

(继承自 ToolStripItem)
OnDoubleClick(EventArgs)

引发 DoubleClick 事件。

(继承自 ToolStripItem)
OnDragDrop(DragEventArgs)

引发 DragDrop 事件。

(继承自 ToolStripItem)
OnDragEnter(DragEventArgs)

引发 DragEnter 事件。

(继承自 ToolStripItem)
OnDragLeave(EventArgs)

引发 DragLeave 事件。

(继承自 ToolStripItem)
OnDragOver(DragEventArgs)

引发 DragOver 事件。

(继承自 ToolStripItem)
OnDropDownClosed(EventArgs)

引发 DropDownClosed 事件。

OnDropDownHide(EventArgs)

为响应 HideDropDown() 方法而引发。

OnDropDownItemClicked(ToolStripItemClickedEventArgs)

引发 DropDownItemClicked 事件。

OnDropDownOpened(EventArgs)

引发 DropDownOpened 事件。

OnDropDownShow(EventArgs)

为响应 ShowDropDown() 方法而引发。

OnEnabledChanged(EventArgs)

引发 EnabledChanged 事件。

(继承自 ToolStripItem)
OnFontChanged(EventArgs)

引发 FontChanged 事件。

OnForeColorChanged(EventArgs)

引发 ForeColorChanged 事件。

(继承自 ToolStripItem)
OnGiveFeedback(GiveFeedbackEventArgs)

引发 GiveFeedback 事件。

(继承自 ToolStripItem)
OnLayout(LayoutEventArgs)

引发 Layout 事件。

(继承自 ToolStripItem)
OnLocationChanged(EventArgs)

引发 LocationChanged 事件。

(继承自 ToolStripItem)
OnMouseDown(MouseEventArgs)

引发 MouseDown 事件。

(继承自 ToolStripItem)
OnMouseEnter(EventArgs)

引发 MouseEnter 事件。

(继承自 ToolStripItem)
OnMouseHover(EventArgs)

引发 MouseHover 事件。

(继承自 ToolStripItem)
OnMouseLeave(EventArgs)

引发 MouseLeave 事件。

(继承自 ToolStripItem)
OnMouseMove(MouseEventArgs)

引发 MouseMove 事件。

(继承自 ToolStripItem)
OnMouseUp(MouseEventArgs)

引发 MouseUp 事件。

(继承自 ToolStripItem)
OnOwnerChanged(EventArgs)

引发 OwnerChanged 事件。

(继承自 ToolStripItem)
OnOwnerFontChanged(EventArgs)

FontChanged 的父级上更改 Font 属性后,会引发 ToolStripItem 事件。

(继承自 ToolStripItem)
OnPaint(PaintEventArgs)

引发 Paint 事件。

(继承自 ToolStripItem)
OnParentBackColorChanged(EventArgs)

引发 BackColorChanged 事件。

(继承自 ToolStripItem)
OnParentChanged(ToolStrip, ToolStrip)

引发 ParentChanged 事件。

(继承自 ToolStripItem)
OnParentEnabledChanged(EventArgs)

当项的容器的 EnabledChanged 属性值更改时,会引发 Enabled 事件。

(继承自 ToolStripItem)
OnParentForeColorChanged(EventArgs)

引发 ForeColorChanged 事件。

(继承自 ToolStripItem)
OnParentRightToLeftChanged(EventArgs)

引发 RightToLeftChanged 事件。

(继承自 ToolStripItem)
OnQueryContinueDrag(QueryContinueDragEventArgs)

引发 QueryContinueDrag 事件。

(继承自 ToolStripItem)
OnRequestCommandExecute(EventArgs)

在 的上下文 OnClick(EventArgs) 中调用 ,如果上下文允许,则调用 Execute(Object)

(继承自 ToolStripItem)
OnRightToLeftChanged(EventArgs)

引发 RightToLeftChanged 事件。

OnSelectedChanged(EventArgs)

提供当单击 ToolStripDropDownToolStripDropDownButtonToolStripMenuItem 控件时,显示 ToolStripSplitButton 的控件的基本功能。

(继承自 ToolStripItem)
OnTextChanged(EventArgs)

引发 TextChanged 事件。

(继承自 ToolStripItem)
OnVisibleChanged(EventArgs)

引发 VisibleChanged 事件。

(继承自 ToolStripItem)
PerformClick()

ToolStripItem 生成 Click 事件。

(继承自 ToolStripItem)
ProcessCmdKey(Message, Keys)

处理命令键。

ProcessDialogKey(Keys)

处理对话框键。

ProcessMnemonic(Char)

处理助记键字符。

(继承自 ToolStripItem)
ResetBackColor()

此方法与此类无关。

(继承自 ToolStripItem)
ResetDisplayStyle()

此方法与此类无关。

(继承自 ToolStripItem)
ResetFont()

此方法与此类无关。

(继承自 ToolStripItem)
ResetForeColor()

此方法与此类无关。

(继承自 ToolStripItem)
ResetImage()

此方法与此类无关。

(继承自 ToolStripItem)
ResetMargin()

此方法与此类无关。

(继承自 ToolStripItem)
ResetPadding()

此方法与此类无关。

(继承自 ToolStripItem)
ResetRightToLeft()

此方法与此类无关。

(继承自 ToolStripItem)
ResetTextDirection()

此方法与此类无关。

(继承自 ToolStripItem)
Select()

选择项。

(继承自 ToolStripItem)
SetBounds(Rectangle)

设置项的大小和位置。

(继承自 ToolStripItem)
SetVisibleCore(Boolean)

ToolStripItem 设置为指定的可见状态。

(继承自 ToolStripItem)
ShowDropDown()

显示与此 ToolStripDropDownItem 关联的 ToolStripDropDownItem 控件。

ToString()

返回包含 Component 的名称的 String(如果有)。 不应重写此方法。

(继承自 ToolStripItem)

事件

AvailableChanged

Available 属性的值更改时发生。

(继承自 ToolStripItem)
BackColorChanged

BackColor 属性的值更改时发生。

(继承自 ToolStripItem)
BindingContextChanged

在绑定上下文更改时发生。

(继承自 BindableComponent)
Click

在单击 ToolStripItem 时发生。

(继承自 ToolStripItem)
CommandCanExecuteChanged

当分配给 属性的 的状态ICommand已更改时CanExecute(Object)发生Command

(继承自 ToolStripItem)
CommandChanged

当属性的 ICommand 分配已 Command 更改时发生。

(继承自 ToolStripItem)
CommandParameterChanged

CommandParameter 属性的值更改后发生。

(继承自 ToolStripItem)
DisplayStyleChanged

DisplayStyle 更改后发生。

(继承自 ToolStripItem)
Disposed

在通过调用 Dispose() 方法释放组件时发生。

(继承自 Component)
DoubleClick

当用鼠标双击项时发生。

(继承自 ToolStripItem)
DragDrop

当用户拖动某项后再释放鼠标按钮时发生,指示此项应该被放入该项内。

(继承自 ToolStripItem)
DragEnter

当用户将某项拖动到该项的工作区内时发生。

(继承自 ToolStripItem)
DragLeave

当用户拖动某项并且鼠标指针不再悬停在此项的工作区上方时发生。

(继承自 ToolStripItem)
DragOver

当用户将某项拖动到此项的工作区上方时发生。

(继承自 ToolStripItem)
DropDownClosed

ToolStripDropDown 关闭时发生。

DropDownItemClicked

在单击 ToolStripDropDown 时发生。

DropDownOpened

ToolStripDropDown 已经打开时发生。

DropDownOpening

ToolStripDropDown 正在打开时发生。

EnabledChanged

Enabled 属性值更改后发生。

(继承自 ToolStripItem)
ForeColorChanged

ForeColor 属性值更改时发生。

(继承自 ToolStripItem)
GiveFeedback

在执行拖动操作期间发生。

(继承自 ToolStripItem)
LocationChanged

当更新 ToolStripItem 的位置时发生。

(继承自 ToolStripItem)
MouseDown

当鼠标指针放置在该项上时,在按鼠标按钮时发生。

(继承自 ToolStripItem)
MouseEnter

在鼠标指针进入项时发生。

(继承自 ToolStripItem)
MouseHover

当鼠标指针悬停在项上时发生。

(继承自 ToolStripItem)
MouseLeave

当鼠标指针离开项时发生。

(继承自 ToolStripItem)
MouseMove

当鼠标指针移到该项上时发生。

(继承自 ToolStripItem)
MouseUp

当鼠标指针位于该项上时,在松开鼠标按钮时发生。

(继承自 ToolStripItem)
OwnerChanged

Owner 属性更改时发生。

(继承自 ToolStripItem)
Paint

在重绘项时发生。

(继承自 ToolStripItem)
QueryAccessibilityHelp

当具有辅助功能的客户端应用程序调用 ToolStripItem 的帮助时发生。

(继承自 ToolStripItem)
QueryContinueDrag

在拖放操作期间发生,并且允许拖动源确定是否应取消拖放操作。

(继承自 ToolStripItem)
RightToLeftChanged

RightToLeft 属性值更改时发生。

(继承自 ToolStripItem)
SelectedChanged

提供当单击 ToolStripDropDownToolStripDropDownButtonToolStripMenuItem 控件时,显示 ToolStripSplitButton 的控件的基本功能。

(继承自 ToolStripItem)
TextChanged

Text 属性的值更改时发生。

(继承自 ToolStripItem)
VisibleChanged

Visible 属性的值更改时发生。

(继承自 ToolStripItem)

显式接口实现

IDropTarget.OnDragDrop(DragEventArgs)

引发 DragDrop 事件。

(继承自 ToolStripItem)
IDropTarget.OnDragEnter(DragEventArgs)

引发 DragEnter 事件。

(继承自 ToolStripItem)
IDropTarget.OnDragLeave(EventArgs)

引发 DragLeave 事件。

(继承自 ToolStripItem)
IDropTarget.OnDragOver(DragEventArgs)

引发 DragOver 事件。

(继承自 ToolStripItem)

适用于

另请参阅