using System.Windows.Forms; ToolStripButton toolStripButton = new ToolStripButton("Button"); toolStripButton.ToolTipText = "This is a tooltip."; toolStripButton.Click += new EventHandler(toolStripButton_Click); void toolStripButton_Click(object sender, EventArgs e) { // Handle the button click event. }
using System.Windows.Forms; ToolStripLabel toolStripLabel = new ToolStripLabel("Label"); toolStripLabel.ToolTipText = "This is a tooltip."; toolStripLabel.Click += new EventHandler(toolStripLabel_Click); void toolStripLabel_Click(object sender, EventArgs e) { // Handle the label click event. }
using System.Windows.Forms; ToolStripDropDownButton toolStripDropDownButton = new ToolStripDropDownButton("Dropdown"); toolStripDropDownButton.ToolTipText = "This is a tooltip."; toolStripDropDownButton.DropDownItems.Add("Item 1"); toolStripDropDownButton.DropDownItems.Add("Item 2"); void toolStripDropDownButton_Click(object sender, EventArgs e) { // Handle the dropdown button click event. }This code creates a ToolStripDropDownButton with two items and sets a tooltip and click event handler. Package Library: System.Windows.Forms