本文介绍了获取工具条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

在我的应用程序中,我使用
创建了一个工具条button1
button2
button3
button4
button5

最初,所有按钮的可见性均为假

我创建了一个我想将按钮的可见性设置为true的函数

我通过索引做到了

但我想使用文本(例如button1,button2,.....)


hi to all!

in my application i create a toolstrip with
button1
button2
button3
button4
button5

initially all button visibility is false

i create one function in which i want to set the visibility of button as true

i done that by index

but i want to do it with text (like button1, button2,.....)


private void toolStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
      {
          for (int i = 0; i < toolStrip2.Items.Count; i++)
          {
              if (toolStrip2.Items[i].Selected)
              {
                  int A = i;
                  switch (i)
                  {
                      case 0:
                          statement1
                          break;

                      case 1:
                          statement2
                          break;

                      case 2:
                          toolStrip2.Visible = false;
                          statement3
                          break;


等等

[edit]添加了代码块,将我的内容作为纯文本..."选项已禁用-OriginalGriff [/edit]


and so on

[edit]Code block added, "Treat my content as plain text..." option disabled - OriginalGriff[/edit]

推荐答案


这篇关于获取工具条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 02:41