本文介绍了如何在系统中获取驱动器的图标,并在列表视图框中添加这些图标,并在vb.net中添加相应的驱动器号。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个类似于文件浏览器的程序,所以我正在编写代码以在列表视图框中显示带有驱动器图标的驱动器号,但我不知道如何将它们的图标放在列表视图框中。 br />
我使用的是Microsoft visual basic 2010 express。



我尝试了什么:



I am trying to make a program similar to file explorer so i am writing code to show drive letters with their drive icon in a list view box but i don't know how to put their icon in the list view box.
I am using Microsoft visual basic 2010 express.

What I have tried:

Imports System
Imports System.IO

Public Class Test


    Private Sub Test_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim drives As String() = System.IO.Directory.GetLogicalDrives()
        For Each drive As String In drives
            ListView1.Items.Add(drive)
            'I need to add the icon of the drive
        Next

    End Sub
End Class

推荐答案



这篇关于如何在系统中获取驱动器的图标,并在列表视图框中添加这些图标,并在vb.net中添加相应的驱动器号。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 02:33