- Public Class Form1
 
 - Public Event Tick As EventHandler
 
  複製代碼-  
 
 -     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
 -         NumericUpDown1.Minimum = 1     
 
 -         NumericUpDown2.Minimum = 1     
 
 -         NumericUpDown3.Minimum = 1     
 
 -         NumericUpDown1.Maximum = 23    
 
 -         NumericUpDown2.Maximum = 59    
 
 -         NumericUpDown3.Maximum = 59    End Sub
 
 
  複製代碼-  
 
 -     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
 -         Me.Timer1.Enabled = True
 
 -     End Sub
 
 
  複製代碼-  
 
 -     Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
 
 -         Me.Show()
 
 -     End Sub
 
 
  複製代碼-  
 
 -     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
 
 -         Dim a, b, c As Long
 
 -         a = Val(TextBox1.Text)
 
 -         b = Val(TextBox2.Text)
 
 -         c = Val(TextBox3.Text)
 
 -         If (a = NumericUpDown1.Value And b = NumericUpDown2.Value And c = NumericUpDown3.Value) Then Shell("shutdown.exe -s -f -t 00")
 
 -         If (a > NumericUpDown1.Value And b > NumericUpDown2.Value And c > NumericUpDown3.Value) Then MsgBox("設定時間小於現在時間,請重新設定", vbCritical, "請重新設定")
 
 -     End Sub
 
 
  複製代碼-  
 
 -     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
 
 -         Me.Size = New Size(504, 206)
 
 -     End Sub
 
 
  複製代碼-  
 
 -     Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
 
 -         TextBox1.Text = ●嚴禁張貼廣告●.Hour.ToString()
 
 -         TextBox2.Text = ●嚴禁張貼廣告●.Minute.ToString()
 
 -         TextBox3.Text = ●嚴禁張貼廣告●.Second.ToString()
 
 -     End Sub
 
 
  複製代碼-  
 
 -     Private Sub 取消自動關機ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 取消自動關機ToolStripMenuItem.Click
 
 -         Me.Timer1.Enabled = False
 
 -     End Sub
 
 
  複製代碼-  
 
 -     Private Sub 直接關機ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 直接關機ToolStripMenuItem.Click
 
 -         Shell("shutdown.exe -s -f -t 00")
 
 -     End Sub
 
 
  複製代碼-  
 
 -     Private Sub 開啟程式ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
 
 -         Me.Show()
 
 -     End Sub
 
 
  複製代碼-  
 
 -     Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
 
 -         If Me.Timer1.Enabled = True Then
 
 -             NotifyIcon1.Text = "自動關機已啟動"
 
 -         ElseIf Me.Timer1.Enabled = False Then
 
 -             NotifyIcon1.Text = "自動關機未啟動"
 
 -         End If
 
 -     End Sub
 
 
  複製代碼-  
 
 -     Private Sub 關閉程式ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 關閉程式ToolStripMenuItem.Click
 
 -         End
 
 -     End Sub
 
 -     Private Sub 開起程式ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 開起程式ToolStripMenuItem.Click
 
 -         Me.Show()
 
 -     End Sub
 
 
  複製代碼-  
 
 -     Private Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
 
 -         If Me.WindowState() = FormWindowState.Minimized Then
 
 -             Me.Hide()
 
 -             NotifyIcon1.Visible = True
 
 -         End If
 
 -     End Sub
 
 -     Private Sub NotifyIcon1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
 
 -         NotifyIcon1.Visible = False
 
 -         Me.Show()
 
 -     End Sub
 
 - End Class
 
 
  複製代碼 
 
我相信貼了一大串程式碼大家一定會不想讀...... 
 
圖示: 
![]() ![]()  |