实现效果:
知识运用:
ComputerInfo类的相关属性 (using Microsoft.VisualBasic.Devices;)
实现代码:
private void timer1_Tick(object sender, EventArgs e) { ComputerInfo comp=new ComputerInfo(); textBox1.Text = Convert.ToString(comp.TotalPhysicalMemory / 1024 / 1024); textBox2.Text = Convert.ToString(comp.AvailablePhysicalMemory / 1024 / 1024); textBox3.Text = Convert.ToString(comp.TotalVirtualMemory / 1024 / 1024); textBox4.Text = Convert.ToString(comp.AvailableVirtualMemory / 1024 / 1024); }