用vb设计软件时子菜单栏中的“另存为”功能怎么实现?要代码程序啊!
我设计的是一个制图软件,用菜单编辑器设计了一个文件主菜单,文件下拉子菜单有新建、打开等,其中的“另存为”功能代码怎么实现?...
我设计的是一个制图软件,用菜单编辑器设计了一个文件主菜单,文件下拉子菜单有新建、打开等,其中的“另存为”功能代码怎么实现?
展开
4个回答
展开全部
使用http://www.promiseforever.com/blog/show-518-1.html
[VB]打造绿色的对话框控件(类)
[VB]如何使用API来制作对话框
http://www.promiseforever.com/blog/show-303-1.html
或者是下面的
使用API GetSaveFileName或控件Commanddialog,
这是API的代码:
{{'Form1 代码
Option Explicit
Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private 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
Dim OFName As OPENFILENAME
Private Function ShowSave() As String
OFName.lStructSize = Len(OFName)
OFName.hwndOwner = Form1.hWnd
OFName.lpstrFilter = "JPG Files (*.jpg)" + Chr$(0) + "*.jpg" + Chr$(0) + "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
OFName.lpstrFile = Space$(254)
OFName.nMaxFile = 255
OFName.lpstrFileTitle = Space$(254)
OFName.nMaxFileTitle = 255
OFName.lpstrInitialDir = "C:\"
OFName.lpstrTitle = "ÎļþÁí´æΪ"
OFName.flags = 0
Debug.Print OFName.nFileExtension
If GetSaveFileName(OFName) Then
ShowSave = Trim$(OFName.lpstrFile)
Else
ShowSave = ""
End If
End Function
Private Sub Command1_Click() 'ShowSave调用:返回的字符串就是路径,若返回空字符串表示取消,
Debug.Print ShowSave
End Sub
}}
[VB]打造绿色的对话框控件(类)
[VB]如何使用API来制作对话框
http://www.promiseforever.com/blog/show-303-1.html
或者是下面的
使用API GetSaveFileName或控件Commanddialog,
这是API的代码:
{{'Form1 代码
Option Explicit
Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private 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
Dim OFName As OPENFILENAME
Private Function ShowSave() As String
OFName.lStructSize = Len(OFName)
OFName.hwndOwner = Form1.hWnd
OFName.lpstrFilter = "JPG Files (*.jpg)" + Chr$(0) + "*.jpg" + Chr$(0) + "All Files (*.*)" + Chr$(0) + "*.*" + Chr$(0)
OFName.lpstrFile = Space$(254)
OFName.nMaxFile = 255
OFName.lpstrFileTitle = Space$(254)
OFName.nMaxFileTitle = 255
OFName.lpstrInitialDir = "C:\"
OFName.lpstrTitle = "ÎļþÁí´æΪ"
OFName.flags = 0
Debug.Print OFName.nFileExtension
If GetSaveFileName(OFName) Then
ShowSave = Trim$(OFName.lpstrFile)
Else
ShowSave = ""
End If
End Function
Private Sub Command1_Click() 'ShowSave调用:返回的字符串就是路径,若返回空字符串表示取消,
Debug.Print ShowSave
End Sub
}}
展开全部
CommonDialog控件可以实现另存为
部件中找 Microsoft Common Dialog Controls 6.0
部件中找 Microsoft Common Dialog Controls 6.0
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
加一个commondialog控件就行。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用通用对话框
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询