小编use*_*442的帖子

为什么我的CPU使用率始终为0%?

这就是我在form1中做的事情:

void PopulateApplications()
{
    DoubleBufferedd(dataGridView1, true);

    int rcount = dataGridView1.Rows.Count;
    int rcurIndex = 0;

    foreach (Process p in Process.GetProcesses())
    {
        try
        {
            if (File.Exists(p.MainModule.FileName))
            {
                memoryUsage = Core.getallmemoryusage(p.ProcessName);
                Core.getcpu(p.ProcessName);
                cpuusage = Core.processes;

                var icon = Icon.ExtractAssociatedIcon(p.MainModule.FileName);
                Image ima = icon.ToBitmap();
                ima = resizeImage(ima, new Size(25, 25));
                ima = (Image)(new Bitmap(ima, new Size(25, 25)));
                String status = p.Responding ? "Running" : "Not Responding";

                if (rcurIndex < rcount - 1)
                {
                    var currentRow = dataGridView1.Rows[rcurIndex];
                    currentRow.Cells[0].Value = ima;
                    currentRow.Cells[1].Value = p.ProcessName;
                    currentRow.Cells[2].Value …
Run Code Online (Sandbox Code Playgroud)

.net c# winforms

9
推荐指数
1
解决办法
2417
查看次数

标签 统计

.net ×1

c# ×1

winforms ×1