设为首页 加入收藏

TOP

类模块基础(二)
2017-10-11 18:12:06 】 浏览:3662
Tags:模块 基础
m
tmpFileExt As String tmpFileExt = LCase(Replace(FileExt, ".", "")) For I = 1 To UBound(pFileExts) If tmpFileExt = pFileExts(I) Then Exit Sub End If Next I ReDim Preserve pFileExts(UBound(pFileExts) + 1) pFileExts(UBound(pFileExts)) = tmpFileExt End Sub Sub CreateDialog() Dim tmpFilter As String pRetVal = 1 tmpFilter = "*." & Join(GetExts, "; *.") pFileNameSelected = Space(255) pRetVal = mdlDialog_fileCreate(pFileNameSelected, 0, 0, _ pDefFileName, tmpFilter, pDefFilePath, "Create File") Select Case pRetVal Case 1 '取消 Case 0 '打开 Dim tmpFile As String Dim xSplit As Variant tmpFile = Left(pFileNameSelected, InStr(1, _ pFileNameSelected, Chr(0) - 1)) xSplit = Split(tmpFile, "\") pFileName = xSplit(UBound(xSplit)) xSplit(UBound(xSplit)) = "" pFliePath = Join(xSplit, "\") End Select End Sub

 

测试代码1:

Sub TestShowDialogA()

Dim MyUSD As New clsUSataionDialog

MyUSD.AddFileExt "dgn"

MyUSD.DefaultPath = "c:\"

MyUSD.DefaultFile = "temp.dgn"

MyUSD.OpenDialog

Select Case MyUSD.OpenSuccess

Case True

MsgBox MyUSD.SelectedPath & MyUSD.SelectedFile

End Select

End Sub

 

测试截图:

clip_image001

测试代码2:

Sub TestShowDialogB()

Dim MyUSD As New clsUSataionDialog

MyUSD.AddFileExt "dgn"

MyUSD.AddFileExt "dwg"

MyUSD.AddFileExt "dxf"

MyUSD.DefaultFile = "c:\MicroStation VBA"

MyUSD.DefaultFile = "test.dgn"

MyUSD.OpenDialog

Select Case MyUSD.OpenSuccess

Case True

MsgBox MyUSD.SelectedPath & MyUSD.SelectedFile

End Select

End Sub

 

测试截图2:

clip_image002

测试代码3:

Sub TestShowDialogC()

Dim MyUSD As New clsUSataionDialog

MyUSD.AddFileExt "dgn"

MyUSD.DefaultFile = "c:\"

MyUSD.DefaultFile = "test.dgn"

MyUSD.CreateDialog

Select Case MyUSD.OpenSuccess

Case True

MsgBox MyUSD.SelectedPath & MyUSD.SelectedFile

End Select

End Sub

 

测试截图3:

clip_image003

测试代码4:

Sub TestShowDialogD()

Dim MyUSD As New clsUSataionDialog

MyUSD.AddFileExt "ILoveyou"

MyUSD.AddFileExt " LOVEYOU"

MyUSD.AddFileExt "Forever"

MyUSD.DefaultPath = "c:\MicroStation VBA"

MyUSD.DefaultFile = "test.dgn"

MyUSD.CreateDialog

Select Case MyUSD.OpenSuccess

Case True

MsgBox MyUSD.SelectedPath & MyUSD.SelectedFile

End Select

End Sub

 

测试截图4:

clip_image004

测试代码5:

Sub TestShowDialogE()

Dim MyUSD As New clsUSataionDialog

MyUSD.AddFileExt "loveyou"

MyUSD.DefaultPath = "c:\"

MyUSD.DefaultFile = "test.dgn"

MyUSD.OpenDialog

Select Case MyUSD.OpenSuccess

Case True

MsgBox "Open " & MyUSD.SelectedPath & _

MyUSD.SelectedFile

Case False

If MsgBox("Create a new file?", vbYesNo) = vbYes Then

MyUSD.CreateDialog

If MyUSD.OpenSuccess = True Then

MsgBox "Create" & MyUSD.SelectedPath & _

MyUSD.SelectedFile

End If

End If

End Select

End Sub

 

测试截图5:

clip_image005

 

 

首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇【转载】DOS 系统和 Windows 系统.. 下一篇[PE格式分析] 1.概述

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目