求助高手

HYB_1107 2008-04-30 11:58:18
和创建你自己的控件相比较,使用控件CommonDialog 的优点是什么?
...全文
167 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
smoked 2008-05-02
  • 打赏
  • 举报
回复
mark
舉杯邀明月 2008-05-02
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 lsftest 的回复:]
使用控件CommonDialog 的优点就是代码量少。
[/Quote]

这个最精典........ ^_^
lsftest 2008-05-02
  • 打赏
  • 举报
回复
使用控件CommonDialog 的优点就是代码量少。
tanjiunnya 2008-05-02
  • 打赏
  • 举报
回复
使用 CommonDialog的控件是 代码精简,减少了繁琐的API。
方便初学者对CommonDialog有所认识和上手~~
嗷嗷叫的老马 2008-05-02
  • 打赏
  • 举报
回复
区别很明显啊........

一个是控件,一个是纯代码.....
silencenet 2008-05-02
  • 打赏
  • 举报
回复
一个用控件-需要带崽走
一个用代码-轻装上阵。。
东方之珠 2008-04-30
  • 打赏
  • 举报
回复
CommonDialog 没什么优点!
建议用API。
比如,打开文件对话框:

标准模块:Module1.bas 

Option Explicit

Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Public Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type



窗体模块:


'Form1上添加一列表框控件List1,一命令按钮Command1
Option Explicit

Private Sub Command1_Click()
Dim ofn As OPENFILENAME
Dim rtn& ', S$, Str$, i%

ofn.lStructSize = Len(ofn)
ofn.hwndOwner = Me.hwnd
ofn.hInstance = App.hInstance
ofn.lpstrFilter = "所有文件"
ofn.lpstrFile = Space(254)
ofn.nMaxFile = 255
ofn.lpstrFileTitle = Space(254)
ofn.nMaxFileTitle = 255
ofn.lpstrInitialDir = App.path
ofn.lpstrTitle = "打开文件"
ofn.flags = 6148
rtn = GetOpenFileName(ofn)
'For i = 1 To Len(Trim(ofn.lpstrFile))
' S = Mid(Trim(ofn.lpstrFile), i, 1)
' If Len(S) <> 0 Then Str = Str & S
'Next
'Debug.Print Str
'List1.AddItem ofn.lpstrFile
If rtn <> 0 Then
List1.AddItem ofn.lpstrFile
Else
List1.AddItem "按了取消键!"
End If
End Sub


























QQ342151559 2008-04-30
  • 打赏
  • 举报
回复
1楼的朋友,能否说下你的程序与CommonDialog 有什么区别吗?
谢谢
舉杯邀明月 2008-04-30
  • 打赏
  • 举报
回复
路过.............
guolibin 2008-04-30
  • 打赏
  • 举报
回复
:)
看到了
awperpvip 2008-04-30
  • 打赏
  • 举报
回复
使用控件CommonDialog 的优点是什么?
...起码便于初学者使用~
问一下楼上的,怎样发出你那种代码的效果?
谢谢。

ABIUS 后面那个图标,点下~
熊孩子开学喽 2008-04-30
  • 打赏
  • 举报
回复
明显的作业题,居然还有这样回答的
guolibin 2008-04-30
  • 打赏
  • 举报
回复
问一下楼上的,怎样发出你那种代码的效果?
谢谢。

1,453

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧