本文介绍了在FolderBrowserDialog中显示文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在FolderBrowserDialog中显示文本框,如下图所示,

how i can show textbox in FolderBrowserDialog like below image,

推荐答案

这不可能直接实现,必须回退到使用shell函数.在项目+添加引用"的浏览"选项卡中,选择c:\ windows \ system32 \ shell32.dll.有关如何在Winforms应用程序中使用它的示例:

This is not directly possible, you have to fallback to using the shell function. Project + Add Reference, Browse tab, select c:\windows\system32\shell32.dll. An example of how to use it in a Winforms app:

Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
    Dim options As Integer = &H40 + &H200 + &H20
    options += &H10   '' Adds edit box
    Dim shell = New Shell32.ShellClass
    Dim root = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    Dim folder = CType(shell.BrowseForFolder(CInt(Me.Handle), _
        "Select folder", options, root), Shell32.Folder2)
    If folder IsNot Nothing Then
        MsgBox("You selected " + folder.Self.Path)
    End If
End Sub

这篇关于在FolderBrowserDialog中显示文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 20:29