언어/C#2010.04.23 17:50

 using System.Diagnostics ;

 protected PerformanceCounter cpuCounter;

 public MyMain(LoginData _Data)
        {
            cpuCounter = new PerformanceCounter();
            cpuCounter.CategoryName = "Processor";                 
            cpuCounter.CounterName = "% Processor Time";
            cpuCounter.InstanceName = "_Total";

         }


 private void MyMain_Load(object sender, EventArgs e)
        {
            Timer T = new Timer();
            T.Interval = 1000;
            T.Tick += new EventHandler(UseingCpuPer);
            T.Start();
        }


  public void UseingCpuPer(Object sender , EventArgs e)
        {
            progressBar3.Value= (int)cpuCounter.NextValue();
            label54.Text = progressBar3.Value.ToString();
          }

Posted by 최우림 -=HaeJuK=-

티스토리 툴바