如何在vb.net中保持点击按钮突出显示?

时间:2019-04-02 02:08:49

标签: .net vb.net

在我的Windows vb.net窗体中,有3个按钮。分别是button1,button2和button3。 我需要保持单击按钮突出显示,直到另一个按钮单击为止。我使用了一些代码但未成功。我怎么了?

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Button1.BackColor = Color.SteelBlue
    Button2.BackColor = Color.Transparent
    Button3.BackColor = Color.Transparent
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    Button2.BackColor = Color.SteelBlue
    Button1.BackColor = Color.Transparent
    Button3.BackColor = Color.Transparent
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
    Button3.BackColor = Color.SteelBlue
    Button2.BackColor = Color.Transparent
    Button1.BackColor = Color.Transparent
End Sub

我需要保持单击的按钮以钢蓝色突出显示,直到再次单击为止。未单击的按钮必须为透明底色。

0 个答案:

没有答案