色偷偷偷久久伊人大杳蕉,色爽交视频免费观看,欧美扒开腿做爽爽爽a片,欧美孕交alscan巨交xxx,日日碰狠狠躁久久躁蜜桃

x
x
查看: 5334|回復(fù): 0
打印 上一主題 下一主題

VB.NET下基于控件的系統(tǒng)托盤及退出保護(hù)設(shè)計(jì)源碼及貼圖

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
發(fā)表于 2009-4-3 00:14:00 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
關(guān)鍵詞: NET , 控件 , 托盤 , 系統(tǒng) , 源碼
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 = "俺是農(nóng)民,俺怕誰???"
        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 '隱藏/顯示窗體轉(zhuǎn)換
        If Me.Visible Then '準(zhǔn)備顯示窗體
            '防止最小化不正常顯示窗體
            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
        '鼠標(biāo)右鍵系統(tǒng)托盤事件處理
        ContextMenuStrip1.Visible = e.Button = MouseButtons.Right '點(diǎn)擊鼠標(biāo)右鍵后顯示菜單
    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 '隱藏窗體轉(zhuǎn)換
                NotifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon("Power.ico") '顯示隱藏的托盤圖標(biāo)
        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("請(qǐng)您確認(rèn)是否退出(Y/N)", "系統(tǒng)提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) = DialogResult.Yes Then
            e.Cancel = False '托盤退出菜單允許退出系統(tǒng)
        Else
            e.Cancel = True '最小最大關(guān)閉菜單退出鈕都會(huì)阻止退出系統(tǒng)
            Me.WindowState = System.Windows.Forms.FormWindowState.Normal
            Me.Visible = False '隱藏窗體轉(zhuǎn)換
            NotifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon("Power.ico") '顯示隱藏的托盤圖標(biāo)
            'MessageBox.Show("請(qǐng)從系統(tǒng)托盤中退出!!!", "系統(tǒng)提示", 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() '退出系統(tǒng)
    End Sub
    Private Sub 關(guān)于ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 關(guān)于ToolStripMenuItem.Click
        'System.Diagnostics.Process.Start("Explorer", "http:\\www.hotpage.net.cn")'運(yùn)行IE
        System.Diagnostics.Process.Start("http:\\www.hotpage.net.cn") '自動(dòng)啟動(dòng)IE
    End Sub
    Private Sub 我不會(huì)VBToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 我不會(huì)VBToolStripMenuItem.Click
        System.Diagnostics.Process.Start("http:\\www.hotpower.org") '自動(dòng)啟動(dòng)IE
    End Sub
    Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
    End Sub
End Class









本版積分規(guī)則

關(guān)于我們  -  服務(wù)條款  -  使用指南  -  站點(diǎn)地圖  -  友情鏈接  -  聯(lián)系我們
電子工程網(wǎng) © 版權(quán)所有   京ICP備16069177號(hào) | 京公網(wǎng)安備11010502021702
快速回復(fù) 返回頂部 返回列表