标签:private src ace .com list event 之一 ima item
实现效果:
知识运用:
DriveInfo类的DriveType属性 //获取驱动器类型
public DriveType DriveType {get;} /属性为枚举值之一
DriveInfo类的VolumeLabel属性 //获取或设置驱动器卷标
public string VolumeLabel {get ; set;}
实现代码:
private void Form1_Load(object sender, EventArgs e) { DriveInfo[] drive = DriveInfo.GetDrives(); foreach(DriveInfo d in drive) { ListViewItem item = new ListViewItem(d.Name); item.SubItems.Add(d.DriveType.ToString()); item.SubItems.Add(d.VolumeLabel); item.SubItems.Add(d.DriveFormat); item.SubItems.Add((d.TotalFreeSpace/1024/1024/1024)+"G"); item.SubItems.Add((d.TotalSize/1024/1024/1024)+"G"); listView1.Items.Add(item); } }
标签:private src ace .com list event 之一 ima item
原文地址:https://www.cnblogs.com/feiyucha/p/10295724.html