国产毛片a精品毛-国产毛片黄片-国产毛片久久国产-国产毛片久久精品-青娱乐极品在线-青娱乐精品

電子工程網

標題: VB.NET下基于控件的系統托盤及退出保護設計源碼及貼圖 [打印本頁]

作者: hotpower    時間: 2009-4-3 00:14
標題: VB.NET下基于控件的系統托盤及退出保護設計源碼及貼圖
Public Class Form1
    Dim SystemExitFlag = False
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = "俺是農民,俺怕誰???"
        RichTextBox1.AppendText(TextBox1.Text)
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ToolStripStatusLabel3.Text = DateTime.Now.ToString()
        If ToolStripProgressBar1.Value < ToolStripProgressBar1.Maximum Then
            ToolStripProgressBar1.Value = ToolStripProgressBar1.Value + ToolStripProgressBar1.Step
        Else
            ToolStripProgressBar1.Value = ToolStripProgressBar1.Minimum
        End If
    End Sub
    Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
        Me.Visible = Not Me.Visible '隱藏/顯示窗體轉換
        If Me.Visible Then '準備顯示窗體
            '防止最小化不正常顯示窗體
            NotifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon("Hot.ico")
            Me.WindowState = System.Windows.Forms.FormWindowState.Normal
        Else
            NotifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon("Power.ico")
        End If
    End Sub
    Private Sub NotifyIcon1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick
        '鼠標右鍵系統托盤事件處理
        ContextMenuStrip1.Visible = e.Button = MouseButtons.Right '點擊鼠標右鍵后顯示菜單
    End Sub
    Private Sub Form1_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs)
        '在Resize事件處理中攔截最小最大消息到托盤
        Select Case Me.WindowState
            Case FormWindowState.Maximized, FormWindowState.Minimized
                Me.WindowState = System.Windows.Forms.FormWindowState.Normal
                Me.Visible = False '隱藏窗體轉換
                NotifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon("Power.ico") '顯示隱藏的托盤圖標
        End Select
    End Sub
    Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        If SystemExitFlag = True AndAlso MessageBox.Show("請您確認是否退出(Y/N)", "系統提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = DialogResult.Yes Then
            e.Cancel = False '托盤退出菜單允許退出系統
        Else
            e.Cancel = True '最小最大關閉菜單退出鈕都會阻止退出系統
            Me.WindowState = System.Windows.Forms.FormWindowState.Normal
            Me.Visible = False '隱藏窗體轉換
            NotifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon("Power.ico") '顯示隱藏的托盤圖標
            'MessageBox.Show("請從系統托盤中退出!!!", "系統提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        End If
    End Sub
    Private Sub 退出ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退出ToolStripMenuItem.Click
        ToolStripStatusLabel2.Text = "非法退出"
        SystemExitFlag = False
        Close() '退入托盤
    End Sub
    Private Sub 退出ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退出ToolStripMenuItem1.Click
        ToolStripStatusLabel2.Text = "正常退出"
        SystemExitFlag = True
        Close() '退出系統
    End Sub
    Private Sub 關于ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 關于ToolStripMenuItem.Click
        'System.Diagnostics.Process.Start("Explorer", "http:\\www.hotpage.net.cn")'運行IE
        System.Diagnostics.Process.Start("http:\\www.hotpage.net.cn") '自動啟動IE
    End Sub
    Private Sub 我不會VBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 我不會VBToolStripMenuItem.Click
        System.Diagnostics.Process.Start("http:\\www.hotpower.org") '自動啟動IE
    End Sub
    Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
    End Sub
End Class














歡迎光臨 電子工程網 (http://m.qingdxww.cn/) Powered by Discuz! X3.4
主站蜘蛛池模板: 国产最新自拍 | 国产成人亚洲综合欧美一部 | 中文字幕日本精品一区二区三区 | www.青青| 性欧美长视频免费观看不卡 | 亚洲国产欧美一区二区欧美 | 91在线视频国产 | 日本高清不卡一区久久精品 | 久久久久久9 | 四虎免费紧急入口2022 | 亚洲欧美日韩在线线精品 | 99看片 | 免费在线日本 | 国产精自产拍久久久久久蜜 | 国内偷自拍对白视频 | 正在播放国产一区 | 男人天堂综合网 | 日本精品久久 | 91国语精品自产拍在线观看性色 | 中文字幕一区二区三区精品 | 精品免费视频 | 日韩成人精品视频 | 思思久久q6热在精品国产 | 亚日韩 | 手机看片一区二区 | aaa免费毛片| 日韩最新视频一区二区三 | 羞羞网站在线观看 | 四虎永久免费影院在线 | 福利国产视频 | 日本亚洲一区二区 | 欧美日韩视频在线一区二区 | 亚洲欧美另类专区 | 国产精品麻豆网站 | 成人精品一区二区久久久 | 被cao的奶水直喷 | 快色在线观看免费播放高清 | 9l国产精品久久久久麻豆 | 亚洲一区浅井舞香在线播放 | 国产国产成人精品久久 | 色视频免费 |