none
information RRS feed

  • Question

  • Hi programmers
    I would like to get your properties from the removable units
    For example:
    File System
    Kind
    Available space
    Used space
    Total capacity
    Graph the unit


    Someone help me please

     
    Tuesday, July 25, 2017 7:15 PM

Answers

  • Hi programmers
    I would like to get your properties from the removable units
    For example:
    File System
    Kind
    Available space
    Used space
    Total capacity
    Graph the unit


    Someone help me please

     

    The information is available from the System.IO.DriveInfo class.

    The graph is up to you to do though.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Tuesday, July 25, 2017 7:25 PM
  • Jen,

    Here is a 3d pie drawing example. Its easy to draw what you have shown as text with a colored rectangle. Then you just need the drive info data as Frank shows.

    Public Class Form2
        Private Sub Form2_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
            DrawDiskSpace(e.Graphics, 75, New Rectangle(100, 50, 100, 70))
        End Sub
    
        Private Sub DrawDiskSpace(g As Graphics, thisPercent As Integer, thisRect As Rectangle)
            With g
                .Clear(Color.White)
                .SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
    
                Using pBlack As New Pen(Color.Black)
    
                    .FillPie(Brushes.DarkRed, thisRect, -20, CSng(thisPercent * 3.6))
                    .DrawEllipse(pBlack, thisRect)
    
                    thisRect.Offset(0, CInt(-thisRect.Height / 10))
                    .FillEllipse(Brushes.Blue, thisRect)
                    .FillPie(Brushes.Red, thisRect, -20, CSng(thisPercent * 3.6))
                    .DrawPie(pBlack, thisRect, -20, CSng(thisPercent * 3.6))
    
                    .DrawString(thisPercent.ToString & " %" & vbLf & "Full", New Font("tacoma", 10, FontStyle.Bold), Brushes.AntiqueWhite, CInt(thisRect.X + (0.3 * thisRect.Width)), CInt(thisRect.Y + (0.5 * thisRect.Height)))
    
                End Using
            End With
        End Sub
    End Class

    Tuesday, July 25, 2017 9:32 PM

All replies

  • Hi programmers
    I would like to get your properties from the removable units
    For example:
    File System
    Kind
    Available space
    Used space
    Total capacity
    Graph the unit


    Someone help me please

     

    The information is available from the System.IO.DriveInfo class.

    The graph is up to you to do though.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Tuesday, July 25, 2017 7:25 PM
  • Is there any way to plot the unit?
    Tuesday, July 25, 2017 7:34 PM
  • Is there any way to plot the unit?

    Honestly I'm not sure what you mean. Explain?

    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Tuesday, July 25, 2017 7:37 PM
  • What I want is to show in a graph of the unit, free space and space used, for example:

    Tuesday, July 25, 2017 7:52 PM
  • What I want is to show in a graph of the unit, free space and space used, for example:

    Sorry for the delay -- I have critical things moved over to my laptop here but my main computer's c:\ is having a bad day! It's bad when a drive goes bad but when it's the main drive, it's very bad.

    *****

    To answer your question, I don't know of an automatic way to do that. You could effectively do it yourself with the information from DriveInfo, but the graph would be up to you to do. I don't ever deal with the "out of the box" version of graphing so that part I can't help with.


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Tuesday, July 25, 2017 9:22 PM
  • Jen,

    Here is a 3d pie drawing example. Its easy to draw what you have shown as text with a colored rectangle. Then you just need the drive info data as Frank shows.

    Public Class Form2
        Private Sub Form2_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
            DrawDiskSpace(e.Graphics, 75, New Rectangle(100, 50, 100, 70))
        End Sub
    
        Private Sub DrawDiskSpace(g As Graphics, thisPercent As Integer, thisRect As Rectangle)
            With g
                .Clear(Color.White)
                .SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
    
                Using pBlack As New Pen(Color.Black)
    
                    .FillPie(Brushes.DarkRed, thisRect, -20, CSng(thisPercent * 3.6))
                    .DrawEllipse(pBlack, thisRect)
    
                    thisRect.Offset(0, CInt(-thisRect.Height / 10))
                    .FillEllipse(Brushes.Blue, thisRect)
                    .FillPie(Brushes.Red, thisRect, -20, CSng(thisPercent * 3.6))
                    .DrawPie(pBlack, thisRect, -20, CSng(thisPercent * 3.6))
    
                    .DrawString(thisPercent.ToString & " %" & vbLf & "Full", New Font("tacoma", 10, FontStyle.Bold), Brushes.AntiqueWhite, CInt(thisRect.X + (0.3 * thisRect.Width)), CInt(thisRect.Y + (0.5 * thisRect.Height)))
    
                End Using
            End With
        End Sub
    End Class

    Tuesday, July 25, 2017 9:32 PM
  • Between tommy and frank you should be able to move forward. Try to work through the task and if you run into roadblocks post your code and explain where the issues are.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, July 25, 2017 11:52 PM
    Moderator
  • Thank you very much, it works.
    Wednesday, July 26, 2017 7:54 PM
  • Thank you very much, it works me wonderfully.
    Wednesday, July 26, 2017 7:55 PM
  • Thank you very much, it works me wonderfully.

    I'm not sure if you're talking to me or not (we don't all see this forum the same way), but either way -- I'm glad you got it all working ok. :)

    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Wednesday, July 26, 2017 9:03 PM