我在表单上有一个工具条控件,我使用以下代码以编程方式将按钮添加到工具条控件
toolStrip1.Visible = true;
ToolStripItem t = new ToolStripButton();
t.Text = client.EndPoint.ToString();
t.TextImageRelation = TextImageRelation.ImageAboveText;
t.BackgroundImage = Image.FromFile("" + Application.StartupPath + "ps1_new.PNG");
t.AutoSize = false;
t.Height = 67;
t.Width = 70;
t.BackgroundImageLayout = ImageLayout.Stretch;
t.TextAlign = ContentAlignment.BottomCenter;
toolStrip1.Items.Add(t);
现在,当我单击它时,我试图获取工具条按钮的索引,注意我可以使用获取单击的工具条按钮的文本
e.ClickedItem.Text;