ToolStripButton Constructors

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Initializes a new instance of the ToolStripButton class.

Overloads

ToolStripButton()

Initializes a new instance of the ToolStripButton class.

ToolStripButton(Image)

Initializes a new instance of the ToolStripButton class that displays the specified image.

ToolStripButton(String)

Initializes a new instance of the ToolStripButton class that displays the specified text.

ToolStripButton(String, Image)

Initializes a new instance of the ToolStripButton class that displays the specified text and image.

ToolStripButton(String, Image, EventHandler)

Initializes a new instance of the ToolStripButton class that displays the specified text and image and that raises the Click event.

ToolStripButton(String, Image, EventHandler, String)

Initializes a new instance of the ToolStripButton class with the specified name that displays the specified text and image and that raises the Click event.

ToolStripButton()

Source:
ToolStripButton.cs
Source:
ToolStripButton.cs
Source:
ToolStripButton.cs

Initializes a new instance of the ToolStripButton class.

C#
public ToolStripButton();

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ToolStripButton(Image)

Source:
ToolStripButton.cs
Source:
ToolStripButton.cs
Source:
ToolStripButton.cs

Initializes a new instance of the ToolStripButton class that displays the specified image.

C#
public ToolStripButton(System.Drawing.Image image);
C#
public ToolStripButton(System.Drawing.Image? image);

Parameters

image
Image

The image to display on the ToolStripButton.

Remarks

Use this constructor to create a ToolStripButton that displays only an image on the ToolStripButton.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ToolStripButton(String)

Source:
ToolStripButton.cs
Source:
ToolStripButton.cs
Source:
ToolStripButton.cs

Initializes a new instance of the ToolStripButton class that displays the specified text.

C#
public ToolStripButton(string text);
C#
public ToolStripButton(string? text);

Parameters

text
String

The text to display on the ToolStripButton.

Remarks

Use this constructor to create a ToolStripButton that displays only text on the ToolStripButton.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ToolStripButton(String, Image)

Source:
ToolStripButton.cs
Source:
ToolStripButton.cs
Source:
ToolStripButton.cs

Initializes a new instance of the ToolStripButton class that displays the specified text and image.

C#
public ToolStripButton(string text, System.Drawing.Image image);
C#
public ToolStripButton(string? text, System.Drawing.Image? image);

Parameters

text
String

The text to display on the ToolStripButton.

image
Image

The image to display on the ToolStripButton.

Remarks

Use this constructor to create a ToolStripButton that displays both an image and text.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ToolStripButton(String, Image, EventHandler)

Source:
ToolStripButton.cs
Source:
ToolStripButton.cs
Source:
ToolStripButton.cs

Initializes a new instance of the ToolStripButton class that displays the specified text and image and that raises the Click event.

C#
public ToolStripButton(string text, System.Drawing.Image image, EventHandler onClick);
C#
public ToolStripButton(string? text, System.Drawing.Image? image, EventHandler? onClick);

Parameters

text
String

The text to display on the ToolStripButton.

image
Image

The image to display on the ToolStripButton.

onClick
EventHandler

An event handler that raises the Click event.

Remarks

Use this constructor to create a ToolStripButton that displays both an image and text and raises the Click event when clicked.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

ToolStripButton(String, Image, EventHandler, String)

Source:
ToolStripButton.cs
Source:
ToolStripButton.cs
Source:
ToolStripButton.cs

Initializes a new instance of the ToolStripButton class with the specified name that displays the specified text and image and that raises the Click event.

C#
public ToolStripButton(string text, System.Drawing.Image image, EventHandler onClick, string name);
C#
public ToolStripButton(string? text, System.Drawing.Image? image, EventHandler? onClick, string? name);

Parameters

text
String

The text to display on the ToolStripButton.

image
Image

The image to display on the ToolStripButton.

onClick
EventHandler

An event handler that raises the Click event.

name
String

The name of the ToolStripButton.

Remarks

Use this constructor to create a ToolStripButton with the specified name that displays both an image and text and raises the Click event when clicked.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10