磁盘(含优盘识别)读写速度测试

可以测试驱动器(包含优盘自动识别插入、卸载)的读(Read)写(Write)速度,并以图形化的方式直观显示

读写按照二进制形式进行测试

程序运行效果图如下:

 

 

主要源码如下:

1、柱状图控件源码

Public   Class SpeedView

    
Private xStep, yStep As Single
    
Private mMaxSpeed As Integer = 10
    
Private Infos As New ArrayList

    
Public Class Info
        
Public Write As Integer
        
Public Read As Integer
        
Public y As Single
        
Public DrawWrite As Boolean
        
Public DrawRead As Boolean
    
End Class


    
Public Property MaxSpeed() As Integer
        
Get
            
Return mMaxSpeed
        
End Get
        
Set(ByVal value As Integer)
            
If mMaxSpeed <> value Then
                mMaxSpeed 
= value
                PictureBox1.Invalidate()
                
Me.Invalidate()
            
End If
        
End Set
    
End Property


    
Private Sub PictureBox1_Paint(ByVal sender As ObjectByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
        
Dim point1, point2 As PointF

        
'绘制网格
        For i As Integer = 1 To 9
            point1 
= New PointF(xStep * i, 0)
            point2 
= New PointF(xStep * i, PictureBox1.Height)
            e.Graphics.DrawLine(Pens.Blue, point1, point2)
        
Next

        
'绘制图形
        For i As Integer = 0 To Infos.Count - 1
            
Dim ThisInfo As Info = CType(Infos(i), Info)

            
'绘制写速度
            If ThisInfo.DrawWrite Then
                
Dim p1, p2 As Point
                p1 
= New Point(0, yStep * i)
                p2 
= New Point(ThisInfo.Write * PictureBox1.Width / (MaxSpeed * 1024), yStep * i)
                e.Graphics.DrawLine(
New Pen(Color.Red, 4), p1, p2)
            
End If

            
'绘制读速度
            If ThisInfo.DrawRead Then
                
Dim p1, p2 As Point
                p1 
= New Point(0, yStep * i + 4)
                p2 
= New Point(ThisInfo.Read * PictureBox1.Width / (MaxSpeed * 1024), yStep * i + 4)
                e.Graphics.DrawLine(
New Pen(Color.Black, 4), p1, p2)
            
End If
        
Next
    
End Sub


    
Private Sub PictureBox1_SizeChanged(ByVal sender As ObjectByVal e As System.EventArgs) Handles PictureBox1.SizeChanged
        xStep 
= PictureBox1.Width / 10
        yStep 
= PictureBox1.Height / 12
    
End Sub


    
Private Sub SpeedView_Paint(ByVal sender As ObjectByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        
'绘制x轴刻度
        For i As Integer = 0 To 10
            
Dim point As Point
            
Dim str As String = (MaxSpeed * i / 10).ToString
            
Dim size As SizeF = e.Graphics.MeasureString(strMe.Font)
            point 
= New Point(PictureBox1.Left + i * xStep - size.Width / 2, PictureBox1.Bottom)
            e.Graphics.DrawString(
strMe.Font, Brushes.Black, point)
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值