P star drive properties
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;
using System.IO;
namespace information
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
DriveInfo[] drive = DriveInfo.GetDrives();
foreach (DriveInfo info in drive)
{
if (info.DriveType == DriveType.Fixed)
cmbdrive.Items.Add(info.Name.ToString());
}
cmbdrive.SelectedIndex = 0;
}
private void cmbdrive_SelectedIndexChanged(object sender, EventArgs e)
{
this.Refresh();
string infodrive = cmbdrive.SelectedItem.ToString();
DriveInfo informationdrive = new DriveInfo(infodrive);
long totalsize = informationdrive.TotalSize;
long freespace = informationdrive.TotalFreeSpace;
long usespace = totalsize - freespace;
total.Text =totalsize / (1024 * 1024) + " MB";
free.Text =freespace / (1024 * 1024) + " MB";
use.Text =(totalsize - freespace) / (1024 * 1024) + " MB";
vol.Text = informationdrive.VolumeLabel;
format.Text = informationdrive.DriveFormat.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}