通过


ToolStripDropDownItem 类

定义

为单击时ToolStripDropDownButtonToolStripMenuItemToolStripSplitButton单击控件的ToolStripDropDown控件提供基本功能。

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

注解

ToolStripDropDownItem是抽象基类,ToolStripMenuItemToolStripDropDownButton可以ToolStripSplitButton直接托管项,也可以托管下拉列表容器中的其他项。 通过将属性设置为DropDownToolStripDropDown和设置ItemsToolStripDropDown属性来执行此操作。 直接通过 DropDownItems 属性访问这些下拉列表项。

构造函数

名称 说明
ToolStripDropDownItem()

初始化 ToolStripDropDownItem 类的新实例。

ToolStripDropDownItem(String, Image, EventHandler, String)

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

ToolStripDropDownItem(String, Image, EventHandler)

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

ToolStripDropDownItem(String, Image, ToolStripItem[])

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

属性

名称 说明
AccessibilityObject

AccessibleObject获取分配给控件的控件。

(继承自 ToolStripItem)
AccessibleDefaultActionDescription

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

(继承自 ToolStripItem)
AccessibleDescription

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

(继承自 ToolStripItem)
AccessibleName

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

(继承自 ToolStripItem)
AccessibleRole

获取或设置控件的可访问角色,该角色指定控件的用户界面元素的类型。

(继承自 ToolStripItem)
Alignment

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

(继承自 ToolStripItem)
AllowDrop

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

(继承自 ToolStripItem)
Anchor

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

(继承自 ToolStripItem)
AutoSize

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

(继承自 ToolStripItem)
AutoToolTip

获取或设置一个值,该值指示是使用 Text 工具提示的属性还是 ToolTipText 属性 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 Click 事件时将调用其Execute(Object)方法。

(继承自 ToolStripItem)
CommandParameter

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

(继承自 ToolStripItem)
Container

IContainer获取包含 .Component

(继承自 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

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

DropDownLocation

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

Enabled

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

(继承自 ToolStripItem)
Events

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

(继承自 Component)
Font

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

(继承自 ToolStripItem)
ForeColor

获取或设置项的前景色。

(继承自 ToolStripItem)
HasDropDown

获取或设置一个值,该值指示是否已 DropDown 创建该对象的值 ToolStripDropDownItem

HasDropDownItems

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

Height

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

(继承自 ToolStripItem)
Image

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

(继承自 ToolStripItem)
ImageAlign

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

(继承自 ToolStripItem)
ImageIndex

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

(继承自 ToolStripItem)
ImageKey

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

(继承自 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

获取或设置该项是附加到 ToolStrip 两者之间还是 ToolStripOverflowButton 可以浮动。

(继承自 ToolStripItem)
Owner

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

(继承自 ToolStripItem)
OwnerItem

获取此ToolStripItem项的父ToolStripItem级。

(继承自 ToolStripItem)
Padding

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

(继承自 ToolStripItem)
Parent

获取或设置 . ToolStripItem的父容器。

(继承自 ToolStripItem)
Placement

获取项的当前布局。

(继承自 ToolStripItem)
Pressed

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

Renderer

返回父 ToolStrip级的呈现器。

(继承自 ToolStripItem)
RightToLeft

获取或设置一个值,该值指示项目是否从右到左放置,文本是从右到左写入的。

(继承自 ToolStripItem)
RightToLeftAutoMirrorImage

将属性设置为 /> 时,自动镜像图像。

(继承自 ToolStripItem)
Selected

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

(继承自 ToolStripItem)
ShowKeyboardCues

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

(继承自 ToolStripItem)
Site

获取或设置 ISite .Component

(继承自 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, Bitmap, Point, Boolean)

开始拖动操作。

(继承自 ToolStripItem)
DoDragDrop(Object, DragDropEffects)

开始拖放操作。

(继承自 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当属性在父级ToolStripItem上发生更改时Font引发事件。

(继承自 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)

引发 SelectedChanged 事件。

(继承自 ToolStripItem)
OnTextChanged(EventArgs)

引发 TextChanged 事件。

(继承自 ToolStripItem)
OnVisibleChanged(EventArgs)

引发 VisibleChanged 事件。

(继承自 ToolStripItem)
PerformClick()

ClickToolStripItem. 生成事件

(继承自 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()

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

(继承自 ToolStripItem)

活动

名称 说明
AvailableChanged

Available 属性的值更改时发生。

(继承自 ToolStripItem)
BackColorChanged

BackColor 属性的值更改时发生。

(继承自 ToolStripItem)
BindingContextChanged

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

(继承自 BindableComponent)
Click

单击时 ToolStripItem 发生。

(继承自 ToolStripItem)
CommandCanExecuteChanged

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

(继承自 ToolStripItem)
CommandChanged

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

(继承自 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

Selected 属性的值更改时发生。

(继承自 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)

适用于

另请参阅