⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 openfiledialog.vb

📁 Pocket Image Editor v0.1源码(.NET源码)
💻 VB
字号:
'
' OpenFileDialog implementation for Smartphone
' Designed to follow object model of desktop framework control
' (c) 2004 Peter Foot, OpenNETCF
'
Imports System
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text

Namespace OpenNETCF.Windows.Forms

    '/ <summary>
    '/ Represents a common dialog box that displays the control that allows the user to open a file, specifically implemented for Smartphone devices.
    '/ </summary>
    Public Class OpenFileDialog
        Inherits CommonDialog
        Private Const MaxPath As Integer = 255

        Private m_fl As FileListDialog

        '/ <summary>
        '/ Initializes a new instance of OpenFileDialog
        '/ </summary>
        Public Sub New()
            m_fl = New FileListDialog
            'set startup in users My Documents folder
            m_fl.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
            m_fl.Filter = "All Files|*.*"
            m_fl.FilterIndex = 1
        End Sub 'New

        '/ <summary>
        '/ Runs the common dialog box.
        '/ </summary>
        '/ <returns></returns>
        Public Shadows Function ShowDialog() As DialogResult
            'show the file list
            Return m_fl.ShowDialog()
        End Function 'ShowDialog

        '/ <summary>
        '/ Resets all properties to their default values.
        '/ </summary>
        Public Sub Reset()
            m_fl.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
            m_fl.Filter = "All Files|*.*"
            m_fl.FilterIndex = 1
            m_fl.RefreshList()
        End Sub 'Reset

        '/ <summary>
        '/ Gets or sets a string containing the file name selected in the file dialog box.
        '/ </summary>
        Public ReadOnly Property FileName() As String
            Get
                Return m_fl.FileName
            End Get
        End Property

        '/ <summary>
        '/ Gets or sets the current file name filter string, which determines what type of files will be displayed.
        '/ </summary>
        Public Property Filter() As String
            Get
                Return m_fl.Filter
            End Get
            Set(ByVal Value As String)
                m_fl.Filter = Value
            End Set
        End Property

        '/ <summary>
        '/  Gets or sets the index of the filter currently selected in the file dialog box.
        '/ </summary>
        Public Property FilterIndex() As Integer
            Get
                Return m_fl.FilterIndex
            End Get
            Set(ByVal Value As Integer)
                m_fl.FilterIndex = Value
            End Set
        End Property

        '/ <summary>
        '/ Gets or sets the initial directory displayed by the file dialog box.
        '/ </summary>
        Public Property InitialDirectory() As String
            Get
                Return m_fl.InitialDirectory
            End Get
            Set(ByVal Value As String)
                m_fl.InitialDirectory = Value
            End Set
        End Property

        '/ <summary>
        '/ Gets or sets the file dialog box title.
        '/ </summary>
        Public Property Title() As String
            Get
                Return m_fl.Text
            End Get
            Set(ByVal Value As String)
                m_fl.Text = Value
            End Set
        End Property
    End Class 'OpenFileDialog
End Namespace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -