Sürücü Bilgi Formu

Yazar jawscod2

Imports System.IO

Public Class Form1
Private surucu_bilgi As DirectoryInfo
Private toplam_alan As Long
Private bos_alan As Long
Private kullanilan_alan As Long
Private tara As Single
Private alan_bilgi As Boolean

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.surucu_durum.Text = “”

Dim drives As System.IO.DriveInfo() = System.IO.DriveInfo.GetDrives
suruculer.Items.AddRange(drives)
End Sub

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim rect As Rectangle = New Rectangle(370, 20, 200, 200)
Dim rect2 As Rectangle = New Rectangle(310, 10, 320, 320)
Dim bos_alan_2 As Rectangle = New Rectangle(320, 275, 20, 20)
Dim kullanılan_alan_2 As Rectangle = New Rectangle(320, 300, 20, 20)

e.Graphics.DrawRectangle(Pens.Red, rect2)

If alan_bilgi = True Then

‘pastayı çiz
e.Graphics.FillPie(Brushes.Yellow, rect, 0, tara)
e.Graphics.FillPie(Brushes.Red, rect, tara, 360 - tara)

‘kareyi çiz
e.Graphics.FillRectangle(Brushes.Red, bos_alan_2)
e.Graphics.FillRectangle(Brushes.Yellow, kullanılan_alan_2)

‘yazıları ekle
e.Graphics.DrawString(”kapasite;”, New Font(”arial”, 10, FontStyle.Regular), Brushes.Red, New PointF(335, 230))
e.Graphics.DrawString(”kullanılan alan:”, New Font(”arial”, 10, FontStyle.Regular), Brushes.Red, New PointF(350, 275))
e.Graphics.DrawString(”bos alan:”, New Font(”arial”, 10, FontStyle.Regular), Brushes.Red, New PointF(350, 300))
e.Graphics.DrawString(toplam_alan.ToString(”N3″) + ” ” + “byte”, New Font(”arial”, 10, FontStyle.Regular), Brushes.Red, New PointF(450, 230))
e.Graphics.DrawString(kullanilan_alan.ToString(”N0″) + ” ” + “byte”, New Font(”arial”, 10, FontStyle.Regular), Brushes.Red, New PointF(450, 275))
e.Graphics.DrawString(bos_alan.ToString(”N0″) + ” ” + “byte”, New Font(”arial”, 10, FontStyle.Regular), Brushes.Red, New PointF(450, 300))
End If
End Sub
Private Sub suruculer_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles suruculer.SelectedIndexChanged

’seçilen sürücüye göre yeniden yükle
surucu_yukle(suruculer.Items(suruculer.SelectedIndex).ToString)

‘grafiği yeniden çiz
Me.Invalidate()

End Sub

Private Sub surucu_yukle(ByVal surucu_harf As String)
Dim surucu_bilgisi As System.IO.DriveInfo

‘geçerli sürücüleri doğrula
Try
surucu_bilgisi = New System.IO.DriveInfo(surucu_harf)

Catch ex As Exception
MessageBox.Show(”Sürücü Harfi Boş Olamaz./a/z” + ex.Message, “Sürücü Harfi Hatalı”, MessageBoxButtons.OK, MessageBoxIcon.Error)
Return
Catch ex2 As ArgumentException
MessageBox.Show(”Sürücü Harfi a-z arasında Olmalı/a/z” + ex2.Message, “Sürücü Harfi Hatası”, MessageBoxButtons.OK, MessageBoxIcon.Error)
Return

End Try
Me.surucuismitext.Text = surucu_bilgisi.Name
Try
If surucu_bilgisi.VolumeLabel.Length > 0 Then
Me.surucutiptext.Text = surucu_bilgisi.VolumeLabel
Else
Me.surucutiptext.Text = “Etiket Yok”
End If
Me.dosyasistemtext.Text = surucu_bilgisi.DriveFormat
toplam_alan = surucu_bilgisi.TotalSize
bos_alan = surucu_bilgisi.TotalFreeSpace
kullanilan_alan = toplam_alan - bos_alan
tara = 360.0F * bos_alan / toplam_alan
alan_bilgi = True

Catch
Me.surucuetikettext.Text = “Erişilemiyor”
Me.dosyasistemtext.Text = “Erişilemiyor”
alan_bilgi = False

End Try

Me.surucutiptext.Text = surucu_bilgisi.DriveType.ToString

Me.kokdizintext.Text = surucu_bilgisi.RootDirectory.ToString
surucu_bilgi = surucu_bilgisi.RootDirectory

If surucu_bilgisi.IsReady = True Then

Me.surucu_durum.Text = “sürücü hazır”
Else

Me.surucu_durum.Text = “sürücü hazır değil”

End If

End Sub

Private Function ConvertBytesToMB(ByVal bytes As Int64) As String
Dim mb As Long = bytes / 1048576
Return mb.tostring(”N”)

End Function

Private Function ConvertBytesToGB(ByVal bytes As Int64) As String
Dim gb As Long = bytes / 1073741824
Return gb.ToString(”N”)

End Function
End Class

Bu yazı toplamda 46, bugün ise 0 kez görüntülenmiş

Bu konularda ilginizi çekebilir


Aradığınız konu hakkında yeterli içeriği sitemizde bulamadıysanız, aşağıdaki kutucuklardan google ve yahoo arama motorlarında arama yapabilirsiniz.
Google
 

CommentYorum

*
Dikkat! Gönder butonuna basmadan önce, aşağıdaki kutuya yan resimdeki kelimeyi yazınız. Resimdeki yazıyı okuyamıyorsanız, üzerine tıklayarak ses ile harfleri dinleyebilirsiniz. Yorumunuz için teşekkür ederiz.
Click to hear an audio file of the anti-spam word