单击主按钮时,激活/显示子按钮. [英] Activate/Display sub-button when main button is clicked.
本文介绍了单击主按钮时,激活/显示子按钮.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有几个主按钮,每个主按钮都有很多不同的子按钮批次.单击主按钮时,将显示一批子按钮.单击另一个主按钮时,先前的子按钮将不可见,并且将显示新一批的子按钮.谢谢你.非常感谢您的帮助.
这是代码:
I have a few main buttons and a lot different batch of sub-buttons for each main button. When a main button is clicked, a batch of sub-buttons will display. When another main button is clicked, previous sub-buttons will be invisible and a new batch of sub-buttons will display. Thank you. Your help is greatly appreciated.
Here is the coding:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button10.Click
Dim Button1 As Button
If Button1.Select() Then
Button6.Visible = True
Button7.Visible = True
Button8.Visible = True
Button9.Visible = True
Else
Button6.Visible = False
Button7.Visible = False
Button8.Visible = False
Button9.Visible = False
End If
End Sub
推荐答案
创建两个面板并将每个按钮中的两组按钮放置在一起,而不是立即执行当前操作.在主按钮上单击以切换面板可见性. :thumbsup:
Instead of doing what you are doing right now, create two panels and place the two group of buttons in each. Toggle the panel visiblity on the main button click. :thumbsup:
好吧,我明白了.非常感谢.但是现在的问题是,当单击另一个主按钮时,以前的子按钮应该是隐藏/不可见的.
我已经使用过if-else语句,但是我的代码应该如何处理? Button1.Select()?
alright i get it. Thanks a lot. but now the problem is, when another main button is clicked, previous sub-button should be hidden/invisible.
i have used if-else statement but how should my code goes? Button1.Select() ?
了解您要实现的目标确实很有帮助.在我看来,您想跳到控件(按钮)的特定页面,并且可以使用tabPage控件,这样,当您更改页面时,会自动隐藏该页面上的其他按钮. I.E.
It would really be helpful to know what you are trying to achieve. It sounds to me like you want to jump to a particular page of controls (buttons), and could use the tabPage control, that way when you change pages you automatically hide the other buttons on that page. I.E.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
tabPage1.show()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
tabPage2.show()
End Sub
等等.
and so on.
这篇关于单击主按钮时,激活/显示子按钮.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文