Imports System.Diagnostics
Imports System.Xml
Public Class Form1
Dim PercentualeCpu As New PerformanceCounter("Processor", "% Processor Time", "_Total")
Dim PercentualeCpuIntera As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
MessageBox.Show("La barra di questa applicazione verrà posizionata automaticamente sopra la taskbar in basso a destra, essendo stata configurata per una risoluzione di 1280 * 800 è possibile che non venga visualizzata!!! Per visualizzarla basta selezionare nel menù contestuale dell'icona relativa al programma nella taskbar, la voce Sposta/Blocca barra, la barra verrà posizionata automaticamente all'incirca nella metà della propria risoluzione desktop, spostarla e quindi bloccarla nuovamente. La barra sarà sempre in primo piano, per nasconderla temporaneamente basta portarsi sopra di essa con il mouse e verrà ripristinata automaticamente dopo 3 secondi!!!.", "Avviso", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
PercentualeCpuIntera = (PercentualeCpu.NextValue().ToString())
Me.ProgressBar1.Value = PercentualeCpuIntera
Me.lblPercentualeCpuUso.Text = PercentualeCpuIntera.ToString & "%"
If Me.ProgressBar1.Value = Me.ProgressBar1.Value < 1 Then
End If
End Sub
Private Sub Form1_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.MouseEnter
Me.Opacity = 0
Timer2.Start()
End Sub
Private Sub ProgressBar1_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.MouseEnter
Me.Opacity = 0
Timer2.Start()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Me.Opacity = 90
Timer2.Stop()
End Sub
Private Sub AltaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AltaToolStripMenuItem.Click
Me.Timer1.Interval = 500
End Sub
Private Sub MediaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MediaToolStripMenuItem.Click
Me.Timer1.Interval = 1500
End Sub
Private Sub BassaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BassaToolStripMenuItem.Click
Me.Timer1.Interval = 3000
End Sub
Private Sub SpostaBarraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SpostaBarraToolStripMenuItem.Click
If Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None Then
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
Dim cordinate As System.Drawing.Point
Dim RisDesktopY As Integer = My.Computer.Screen.WorkingArea.Height
Dim RisDesktopX As Integer = My.Computer.Screen.WorkingArea.Width
cordinate.X = RisDesktopX / 2
cordinate.Y = RisDesktopY / 2
Me.Location = cordinate
Else
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End If
End Sub
Private Sub EsciToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EsciToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub InfoSuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InfoSuToolStripMenuItem.Click
AboutBox1.ShowDialog()
End Sub
End Class