Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
CpuBar3d - Form1.vb

Form1.vb

Caricato da: Progman-92
Scarica il programma completo

  1. Imports System.Diagnostics
  2. Imports System.Xml
  3. Public Class Form1
  4.     Dim PercentualeCpu As New PerformanceCounter("Processor", "% Processor Time", "_Total")
  5.     Dim PercentualeCpuIntera As Integer
  6.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.         Timer1.Start()
  8.         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)
  9.     End Sub
  10.  
  11.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  12.         PercentualeCpuIntera = (PercentualeCpu.NextValue().ToString())
  13.         Me.ProgressBar1.Value = PercentualeCpuIntera
  14.         Me.lblPercentualeCpuUso.Text = PercentualeCpuIntera.ToString & "%"
  15.         If Me.ProgressBar1.Value = Me.ProgressBar1.Value < 1 Then
  16.  
  17.         End If
  18.     End Sub
  19.  
  20.     Private Sub Form1_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.MouseEnter
  21.         Me.Opacity = 0
  22.         Timer2.Start()
  23.     End Sub
  24.  
  25.     Private Sub ProgressBar1_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.MouseEnter
  26.         Me.Opacity = 0
  27.         Timer2.Start()
  28.     End Sub
  29.  
  30.     Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
  31.         Me.Opacity = 90
  32.         Timer2.Stop()
  33.     End Sub
  34.  
  35.    Private Sub AltaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AltaToolStripMenuItem.Click
  36.         Me.Timer1.Interval = 500
  37.     End Sub
  38.  
  39.     Private Sub MediaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MediaToolStripMenuItem.Click
  40.         Me.Timer1.Interval = 1500
  41.     End Sub
  42.  
  43.     Private Sub BassaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BassaToolStripMenuItem.Click
  44.         Me.Timer1.Interval = 3000
  45.     End Sub
  46.  
  47.     Private Sub SpostaBarraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SpostaBarraToolStripMenuItem.Click
  48.         If Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None Then
  49.             Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedDialog
  50.             Dim cordinate As System.Drawing.Point
  51.             Dim RisDesktopY As Integer = My.Computer.Screen.WorkingArea.Height
  52.             Dim RisDesktopX As Integer = My.Computer.Screen.WorkingArea.Width
  53.             cordinate.X = RisDesktopX / 2
  54.             cordinate.Y = RisDesktopY / 2
  55.             Me.Location = cordinate
  56.         Else
  57.             Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
  58.         End If
  59.     End Sub
  60.  
  61.     Private Sub EsciToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EsciToolStripMenuItem.Click
  62.         Me.Close()
  63.     End Sub
  64.  
  65.     Private Sub InfoSuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InfoSuToolStripMenuItem.Click
  66.         AboutBox1.ShowDialog()
  67.     End Sub
  68. End Class