using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace aaa
{
/// <summary>
/// DirBrowser 的摘要说明。
/// </summary>
public class DirBrowser : FolderNameEditor
Public Enum Styles
BrowseForComputer
BrowseForEverything
BrowseForPrinter
RestrictToDomain
RestrictToFilesystem
RestrictToSubfolders
ShowTextBox
End Enum
#End Region
#Region " Properties "
Public Property Path() As String
Get
Return m_Path
End Get
Set(ByVal Value As String)
m_Path = Value
End Set
End Property
Public Property Description() As String
Get
Return m_Description
End Get
Set(ByVal Value As String)
m_Description = Value
End Set
End Property
Public Property StartPath() As Locations
Get
Return m_StartPath
End Get
Set(ByVal Value As Locations)
m_StartPath = Value
End Set
End Property
Public Property Style() As Styles
Get
Return m_Style
End Get
Set(ByVal Value As Styles)
m_Style = Value
End Set
End Property
#End Region
Public Function ShowDialog() As System.Windows.Forms.DialogResult
Dim f As New FDialog(Me)
Return f.ShowDialog()
End Function
Public Sub New(ByVal r As BrowseForFolder)
rParentClass = r
End Sub
Public Function ShowDialog() As System.Windows.Forms.DialogResult
Dim fBFF As New System.Windows.Forms.Design.FolderNameEditor.FolderBrowser(), r As System.Windows.Forms.DialogResult
fBFF.Description = rParentClass.Description
Select Case rParentClass.StartPath
Case Locations.Desktop
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.Desktop
Case Locations.Favorites
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.Favorites
Case Locations.MyComputer
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.MyComputer
Case Locations.MyDocuments
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.MyDocuments
Case Locations.MyPictures
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.MyPictures
Case Locations.NetAndDialUpConnections
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.NetAndDialUpConnections
Case Locations.NetworkNeighborhood
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.NetworkNeighborhood
Case Locations.Printers
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.Printers
Case Locations.Recent
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.Recent
Case Locations.SendTo
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.SendTo
Case Locations.StartMenu
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.StartMenu
Case Locations.Templates
fBFF.StartLocation = Windows.Forms.Design.FolderNameEditor.FolderBrowserFolder.Templates
End Select
Select Case rParentClass.Style
Case Styles.BrowseForComputer
fBFF.Style = Windows.Forms.Design.FolderNameEditor.FolderBrowserStyles.BrowseForComputer
Case Styles.BrowseForEverything
fBFF.Style = Windows.Forms.Design.FolderNameEditor.FolderBrowserStyles.BrowseForEverything
Case Styles.BrowseForPrinter
fBFF.Style = Windows.Forms.Design.FolderNameEditor.FolderBrowserStyles.BrowseForPrinter
Case Styles.RestrictToDomain
fBFF.Style = Windows.Forms.Design.FolderNameEditor.FolderBrowserStyles.RestrictToDomain
Case Styles.RestrictToFilesystem
fBFF.Style = Windows.Forms.Design.FolderNameEditor.FolderBrowserStyles.RestrictToFilesystem
Case Styles.RestrictToSubfolders
fBFF.Style = Windows.Forms.Design.FolderNameEditor.FolderBrowserStyles.RestrictToSubfolders
Case Styles.ShowTextBox
fBFF.Style = Windows.Forms.Design.FolderNameEditor.FolderBrowserStyles.ShowTextBox
End Select
r = fBFF.ShowDialog()
If r = Windows.Forms.DialogResult.OK Then
rParentClass.Path = fBFF.DirectoryPath
End If