ToolStrip.CreateDefaultItem(String, Image, EventHandler) ToolStrip.CreateDefaultItem(String, Image, EventHandler) ToolStrip.CreateDefaultItem(String, Image, EventHandler) Method

定义

在新 ToolStrip 实例上使用指定文本、图像和事件处理程序创建默认 ToolStripItemCreates a default ToolStripItem with the specified text, image, and event handler on a new ToolStrip instance.

protected public:
 virtual System::Windows::Forms::ToolStripItem ^ CreateDefaultItem(System::String ^ text, System::Drawing::Image ^ image, EventHandler ^ onClick);
protected internal virtual System.Windows.Forms.ToolStripItem CreateDefaultItem (string text, System.Drawing.Image image, EventHandler onClick);
abstract member CreateDefaultItem : string * System.Drawing.Image * EventHandler -> System.Windows.Forms.ToolStripItem
override this.CreateDefaultItem : string * System.Drawing.Image * EventHandler -> System.Windows.Forms.ToolStripItem

参数

text
String String String

要用于 ToolStripItem 的文本。The text to use for the ToolStripItem. 如果 text 参数是连字符 (-),此方法将创建 ToolStripSeparatorIf the text parameter is a hyphen (-), this method creates a ToolStripSeparator.

image
Image Image Image

要在 ToolStripItem 上显示的 ImageThe Image to display on the ToolStripItem.

onClick
EventHandler EventHandler EventHandler

单击 ToolStripItem 时引发 Click 事件的事件处理程序。An event handler that raises the Click event when the ToolStripItem is clicked.

返回

一个 ToolStripButton(String, Image, EventHandler),或者如果 text 参数为连字符 (-),则为 ToolStripSeparatorA ToolStripButton(String, Image, EventHandler), or a ToolStripSeparator if the text parameter is a hyphen (-).

适用于