vbnet选中文件 vbnet filestream

VB.NET如何右击ListBoxx选择文件?这回没分不写代码 , 哈哈......
利用listbox的MouseDown事件获取当前是哪个鼠标按键点击了控件;
通过MouseEventArgs事件类的Location属性获取鼠标在listbox中的坐标;
通过listbox的行高来计算鼠标在listbox的哪一行;
通过listbox的SelectedIndex属性来选定鼠标所在的那一行 。
PS:算了,好人做到底吧!
Private Sub ListBox1_MouseDown(sender As Object, e As MouseEventArgs) _
Handles ListBox1.MouseDown
If e.Button = Windows.Forms.MouseButtons.Right Then
Dim ht As Integer = ListBox1.ItemHeight
Dim rect As New Rectangle _
(0, 0, ListBox1.ClientSize.Width, ht)
For i As Integer = 0 To ListBox1.Items.Count - 1
If rect.Contains(e.Location) Then
ListBox1.SelectedIndex = i
Exit For
Else
rect.Y= ht
End If
Next
End If
End Sub
vb.net 如何打开listbox被选中文件夹'在窗体启动时,给列表初始化 , 测试用 , 随便添加了几条列表项,并将列表的扩展多选功能打开 。
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.Items.Add("c:\windows\notepad.exe")
ListBox1.Items.Add("c:\windows\system32\notepad.exe")
ListBox1.Items.Add("C:\WINDOWS\Web\Wallpaper\Bliss.bmp")
ListBox1.Items.Add("c:\windows\system32\drivers")
ListBox1.Items.Add("c:\dddddd")
ListBox1.Items.Add("c:\dos\2\3.txt")
ListBox1.SelectionMode = SelectionMode.MultiExtended
End Sub
'打开列表中所有选中的文件或者文件夹,并判断是否存在 。
'如果是文件夹直接打开,如果是文件,打开目录后,并自动选中该文件
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim pr As Process = New Process
Dim curFile As String
For i = 0 To ListBox1.SelectedItems.Count - 1
pr.StartInfo.FileName = "explorer.exe"
curFile = ListBox1.SelectedItems(i)
If System.IO.Directory.Exists(curFile) Then
pr.StartInfo.Arguments = Chr(34)curFileChr(34)
Else
If System.IO.File.Exists(curFile) Then
pr.StartInfo.Arguments = "/n,/select,"Chr(34)ListBox1.SelectedItems(i)Chr(34)
Else
Continue For
End If
End If
pr.Start()
Next
pr = Nothing
End Sub
VB.NET及可以选择文件夹,也可以选择文件的对话框新建立个窗体vbnet选中文件,放入文件夹控件等vbnet选中文件,然后点确定返回一个字符串即可 。
选择文件或者选择文件夹时 , 显示这个窗体,然后取这个字符串 。
求大神指点vb.net 怎么实现鼠标左键按住在移动鼠标达到选中文件的效果呀.我用mouse_even没有效果.看图片背景vbnet选中文件,我又试vbnet选中文件了下资源管理器,文件是选中vbnet选中文件的状态
选中文件和选中文字 , 背景色是不同的
VB.net 中 如何实现选定“文件夹名”显示到指定文本框Dim L As Integer = InStrRev(ModLocationList.Text , "\")
ModRename.Text = Mid(ModLocationList.Text, L1)
vb.net 如何实现文件选择给你一个遍历所有盘符下的文件夹的例子
加一个遍历文件的就可以了 。
TreeNode node = new TreeNode("我的电脑");
treeView.Nodes.Add(node); //加入一个我的电脑节点
string[] drivesName = System.IO.Directory.GetLogicalDrives() //取得驱动器列表的集合
foreach(string name in drivesName) //用foreach遍历集合
{
TreeNode drivesNode = new TreeNode(name);
node.Nodes.Add(drivesNode); //加到我的电脑节点下
【vbnet选中文件 vbnet filestream】关于vbnet选中文件和vbnet filestream的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读