每当表单关闭或最小化时,我都需要隐藏三个复选框。我知道如何通过FormClosing事件隐藏它们。以下是我所拥有的:
Public Sub Tickers_Closed(sender As Object, e As EventArgs) Handles Me.FormClosing
Nordeen_Investing_3.CheckBox_NASDAQ.Hide()
Nordeen_Investing_3.CheckBox_NYSE.Hide()
Nordeen_Investing_3.CheckBox_AMEX.Hide()
End Sub
当表单最小化时,如何隐藏它们?
在vb.net中有一个resize事件。在这个事件中,你只需要放一个if语句,看起来像。。
Private Sub Tickers_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
if me.minimizebox then
Nordeen_Investing_3.CheckBox_NASDAQ.Hide()
Nordeen_Investing_3.CheckBox_NYSE.Hide()
Nordeen_Investing_3.CheckBox_AMEX.Hide()
end if
end sub
我使用了两个答案的组合。以下是行之有效的方法:
Private Sub Tickers_Resize(sender As Object, e As EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
Nordeen_Investing_3.CheckBox_NASDAQ.Hide()
Nordeen_Investing_3.CheckBox_NYSE.Hide()
Nordeen_Investing_3.CheckBox_AMEX.Hide()
End If
End Sub