【C#】WinForm中如何读取CPU的使用率,并显示到Label中

来源:百度知道 编辑:UC知道 时间:2024/05/30 01:14:52
详细点哈,谢啦
要是同时还有相关书籍推荐就更感谢啦

using System.Diagnostics;//添加在引用部分

namespace Winform_Cpu
{
    public partial class Form1 : Form
    {
        private PerformanceCounter PC = new PerformanceCounter();
        public Form1()
        {
            InitializeComponent();
            PC.CategoryName = "Processor";
            PC.CounterName = "% Processor Time";
            PC.InstanceName = "_Total";
&n