• 大小: 0.19M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: C#  磁盘  容量  空间  

资源简介

C# 获取硬盘空间信息 盘符总大小、剩余空间、已用空间

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//www.srcfans.com
namespace GetHardDiskSize
{
    public partial class Frm_Main : Form
    {
        public Frm_Main()
        {
            InitializeComponent();
        }
        private void Frm_Main_Load(object sender EventArgs e)
        {
            System.IO.DriveInfo[] drive = System.IO.DriveInfo.GetDrives();//获取所有驱动器
            for (int i = 0; i < drive.Length; i++)//遍历驱动器
            {
                comboBox1.Items.Add(drive[i].Name);//将驱动器添加到下拉列表中
            }
            comboBox1.SelectedIndex = 0;//设置下拉列表默认选择第一项
        }
        private void comboBox1_SelectedIn

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-12-18 22:14  .vs\
     目录           0  2017-12-18 22:14  .vs\GetHardDiskSize\
     目录           0  2017-12-18 22:14  .vs\GetHardDiskSize\v15\
     文件       38912  2017-12-18 22:21  .vs\GetHardDiskSize\v15\.suo
     目录           0  2017-12-18 22:16  .vs\GetHardDiskSize\v15\sqlite3\
     文件      512000  2017-12-18 22:16  .vs\GetHardDiskSize\v15\sqlite3\storage.ide
     目录           0  2017-12-18 22:14  Backup\
     目录           0  2017-12-18 22:14  Backup\GetHardDiskSize\
     文件         935  2010-08-25 17:06  Backup\GetHardDiskSize.sln
     文件        1820  2017-03-09 18:14  Backup\GetHardDiskSize\Frm_Main.cs
     文件        5052  2010-08-26 08:45  Backup\GetHardDiskSize\Frm_Main.Designer.cs
     文件        5814  2010-08-26 08:45  Backup\GetHardDiskSize\Frm_Main.resx
     文件        3810  2010-08-25 17:07  Backup\GetHardDiskSize\GetHardDiskSize.csproj
     文件         499  2010-08-25 17:07  Backup\GetHardDiskSize\Program.cs
     目录           0  2017-12-18 22:14  Backup\GetHardDiskSize\Properties\
     文件        1362  2010-08-25 17:06  Backup\GetHardDiskSize\Properties\AssemblyInfo.cs
     文件        2880  2010-08-25 17:06  Backup\GetHardDiskSize\Properties\Resources.Designer.cs
     文件        5612  2010-08-25 17:06  Backup\GetHardDiskSize\Properties\Resources.resx
     文件        1100  2010-08-25 17:06  Backup\GetHardDiskSize\Properties\Settings.Designer.cs
     文件         249  2010-08-25 17:06  Backup\GetHardDiskSize\Properties\Settings.settings
     目录           0  2017-12-18 22:16  GetHardDiskSize\
     文件        1144  2017-12-18 22:14  GetHardDiskSize.sln
     文件       15360  2010-09-11 09:39  GetHardDiskSize.suo
     目录           0  2017-12-18 22:14  GetHardDiskSize\bin\
     目录           0  2017-12-18 22:14  GetHardDiskSize\bin\Debug\
     文件        9728  2017-12-18 22:14  GetHardDiskSize\bin\Debug\GetHardDiskSize.exe
     文件       22016  2017-12-18 22:14  GetHardDiskSize\bin\Debug\GetHardDiskSize.pdb
     文件        1801  2017-12-18 22:16  GetHardDiskSize\Frm_Main.cs
     文件        5052  2010-08-26 08:45  GetHardDiskSize\Frm_Main.Designer.cs
     文件        5814  2010-08-26 08:45  GetHardDiskSize\Frm_Main.resx
     文件        4000  2017-12-18 22:14  GetHardDiskSize\GetHardDiskSize.csproj
............此处省略22个文件信息

评论

共有 条评论