以下是引用片段:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;www.goodsgy.com
namespace CpuUsageTest { public partial class frmCpuUsage : Form { public frmCpuUsage() { InitializeComponent(); }www.goodsgy.com
private void Form1_Load(object sender, EventArgs e) {www.goodsgy.com
}www.goodsgy.com
private void timer1_Tick(object sender, EventArgs e) { progressBar1.Value = (int)(performanceCounter1.NextValue()); label1.Text = "Processor Time: " + progressBar1.Value.ToString() + "%"; } } }www.goodsgy.com |