包含vb.net硬盘温度的词条( 四 )


Next i
For i = L To 100
y3 = y + G - i
Pic.Line (x + 10, y3)-(x + D - 10, y3), o
Next i
End Sub
'Gauge Type 1
Sub DrawGauge1(Pic As PictureBox, x, y, G, fa, Text)
PI = 3.1415926543
Z = 5
XT = 0
G1 = Int(G / 100)
Gr = G1 * 70
Z1 = G1 * 110
Z2 = G1 * 130
Z3 = G1 * 90
F1 = G1 - 2
If F110 Then F1 = 10
Pic.FontSize = F1
'Pic.Caption = Str$(g1) + " " + Str$(R)
Pic.Circle (x, y), Gr, fa, 5.8, 4#
For i = 1.78 * PI To 1 Step -0.091
X1 = x + Int(sIn(i) * Z1)
y1 = y + Int(Cos(i) * Z1)
X2 = x + Int(sIn(i) * Z2)
y2 = y + Int(Cos(i) * Z2)
x3 = x + Int(sIn(i) * Z3)
y3 = y + Int(Cos(i) * Z3)
If Z = 5 Then
Pic.DrawWidth = 2
Pic.CurrentX = x3 - 40 - Pic.TextWidth(XT) / 2
Pic.CurrentY = y3 - Pic.TextHeight(XT) / 2
Pic.ForeColor = fa
Pic.Print XT
XT = XT + 10
Else
Pic.DrawWidth = 1
End If
Z = Z + 1
If Z5 Then Z = 1
Pic.Line (X1, y1)-(X2, y2), fa
Next i
Pic.FontSize = 8
Pic.CurrentX = x - (Pic.TextWidth(Text) / 2)
Pic.CurrentY = y + G1 * 80
Pic.Print Text
End Sub
vb.net 未将对象引用设置到对象的实例数组没有初始化vb.net硬盘温度,没有上标vb.net硬盘温度,动态数组得用redim语句
VB6中如何获取磁盘信息?楼上的朋友可能有点小小的误会楼主的意思了,
楼主朋友可能要现在已经分好区的空间大?。延每占洹⑹S嗫占?。
当然我也不敢保证谁对谁错,
我还是把我的理解 然后 也把代码贴出来让楼主看看吧
下面代码的功能:显示光驱当前分区,以及各个盘的总空间 , 剩余空间 。
当然 。如果要硬盘总空间 , 我们可以把所有空间加起来,就达到要求了 。
希望下面的代码对楼主有用!
'硬盘空间大小 以及光驱
'添加Drive1 Label1 Label2
Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Const DRIVE_CDROM = 5
Public drivenm As String, cddrive As String
Private Sub Form_Load()
'查找CD-ROM的驱动器号
cddrive = ""
For i = 65 To 90
If GetDriveType(Chr$(i)":\") = DRIVE_CDROM Then
cddrive = UCase(Chr$(i))":\"
Exit For
End If
Next i
drivenm = "c:"
Label1.AutoSize = True
Label2.AutoSize = True
Drive1.Left = (Me.Width - Drive1.Width) \ 2
Drive1.Drive = "c"
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
gethd
End Sub
Private Sub Form_Activate()
MsgBox "你的光驱在:"cddrive
End Sub
Private Sub Drive1_Change()
drivenm = Mid(Drive1.Drive, 1, 3)
gethd
End Sub
Private Sub gethd() '得知硬盘容量
On Error Resume Next
Dim dfs, cl1, cl2, sec1, byt1, tspace, getdiskvolm, lSize, kk%
Dim hdtype$, hdspace$, hdfspace$
dfs = GetDiskFreeSpace(drivenm, sec1, byt1, cl1, cl2)
If dfs Then
cl2 = Int(cl2 * sec1 / 1024 * byt1)
lSize = Len(Format$(cl2, "#########"))
If lSize11 Then
kk = 11 - lSize
End If
hdspace = Space(kk) + Format$(cl2, "#########") + " KBytes"
cl1 = Int(cl1 * sec1 / 1024 * byt1)
lSize = Len(Format$(cl1, "#########"))
If lSize11 Then
kk = 11 - lSize
End If
hdfspace = Space(kk) + Format$(cl1, "#########") + " KBytes"
Else
hdspace = ""
hdfspace = ""
End If
Label1.Caption = "你的"drivenm"盘的总空间是:"Format(Str(Val(hdspace) / 1024 / 1024), "##0.0") + " G"

推荐阅读