程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> Visual Basic語言 >> VB.NET >> vb.net完成復雜的眼睛維護零碎

vb.net完成復雜的眼睛維護零碎

編輯:VB.NET

vb.net完成復雜的眼睛維護零碎。本站提示廣大學習愛好者:(vb.net完成復雜的眼睛維護零碎)文章只能為提供參考,不一定能成為您想要的結果。以下是vb.net完成復雜的眼睛維護零碎正文


1.前言:由於許多人運用電腦好長時間都不知道休息,我就是其中之一。我自從買了電腦之後,視力在不停的下降,身體也沒有原來好了。對此我非常擔憂,為此我想到了自己做一個強迫限制運用電腦時間,維護眼睛的小軟件。我是用vb.net完成的!

2.根本原理:

我是經過兩個Timer控件控制任務和休息時間,當任務時間過了之後。調用新窗口,新窗口是一個沒有邊框的全屏form並且不能封閉!只要你休息的時間過了窗體自動封閉,在過一段你任務的時間之後,電腦又將鎖定,強迫維護你的眼睛,休息時間和任務時間可以自己設定!但是我建議任務50分鐘後,休息10分鐘!

3.局部代碼: Public Class Form1
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Me.Label5.Text = "零碎以後時間:" & Now
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Me.MaskedTextBox1.Text <> "" And Me.MaskedTextBox2.Text <> "" Then
            Me.Timer2.Enabled = True
            Me.Timer2.Interval = CInt(Me.MaskedTextBox1.Text) * 1000 * 60
            Me.Hide()
        Else
            MsgBox("請你輸出時間!")
        End If
    End Sub
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Dim peng As New Form2()
        Me.Timer2.Enabled = False
        Me.Visible = False
        peng.Show()
    End Sub
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Me.Hide()
        e.Cancel = 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 Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.MaskedTextBox1.Text = 50
        Me.MaskedTextBox2.Text = 10
    End Sub
End Class
Public Class Form2
    Dim i As Long = 0
    Dim flag As Boolean = True
    Private Sub Form2_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        If flag Then
            e.Cancel = True
        End If
    End Sub
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Timer1.Interval = CLng(Form1.MaskedTextBox2.Text) * 1000 * 60
        Me.ProgressBar1.Minimum = 0
        Me.ProgressBar1.Maximum = CLng(Form1.MaskedTextBox2.Text) * 60
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Form1.Timer2.Enabled = True
        Me.Close()
    End Sub
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        If i <= CInt(Form1.MaskedTextBox2.Text) * 60 Then
            Me.Focus()
            Me.TopMost = True
            If i = CInt(Form1.MaskedTextBox2.Text) * 60 - 10 Then
                flag = False
            End If
            Me.WindowState = FormWindowState.Maximized
            i = i + 1
            Me.ProgressBar1.Value = i
        End If
    End Sub
End Class

4.小結:這個軟件根本上完成了維護眼睛和身體的作用,可以阻止瘋狂的運用電腦而不休息。關於維護好自己的眼睛和身體有重要的作用!特征:翻開後不能封閉。除非在義務管理器中完畢進程!需求.NET Framework支持。強迫維護你的身體!有好的身體才有好的今天!建議用1分鐘測試!

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved