VB中要保存图片问题
我的程序CommonDialog1.Filter="JPG文件|*.JPG|所有文件|*.*"CommonDialog1.ShowSaveFileName=CommonD...
我的程序
CommonDialog1.Filter = "JPG文件|*.JPG|所有文件|*.*"
CommonDialog1.ShowSave
FileName = CommonDialog1.FileName
If Command2.Enabled = True Then
SavePicture Pic1.Image, FileName
End If
If Command6.Enabled = True Then
SavePicture Picture1.Image, FileName
End If
那要当 Command2.Enabled = True And Command6.Enabled = True时,怎么编可以保存两幅picture
我想大家还不是很明白我的意思。我上面的程序可以实现保存一幅图片,但是要两幅一起的话大家的方法试了下还是不行
我的程序是写在保存菜单里的:
Private Sub save_Click()
CommonDialog1.Filter = "JPG文件|*.JPG|所有文件|*.*"
If Command2.Enabled = True Then
SavePicture Pic1.Image, FileName
End If
If Command6.Enabled = True Then
SavePicture Picture1.Image, FileName
End If
'If Command2.Enabled = True And Command6.Enabled = True Then
'SavePicture Pic1.Image And Picture1.Image, FileName
'End If
End Sub
请帮我修改一下我打'里面的这几句,实现同时按下按钮保存两幅画 展开
CommonDialog1.Filter = "JPG文件|*.JPG|所有文件|*.*"
CommonDialog1.ShowSave
FileName = CommonDialog1.FileName
If Command2.Enabled = True Then
SavePicture Pic1.Image, FileName
End If
If Command6.Enabled = True Then
SavePicture Picture1.Image, FileName
End If
那要当 Command2.Enabled = True And Command6.Enabled = True时,怎么编可以保存两幅picture
我想大家还不是很明白我的意思。我上面的程序可以实现保存一幅图片,但是要两幅一起的话大家的方法试了下还是不行
我的程序是写在保存菜单里的:
Private Sub save_Click()
CommonDialog1.Filter = "JPG文件|*.JPG|所有文件|*.*"
If Command2.Enabled = True Then
SavePicture Pic1.Image, FileName
End If
If Command6.Enabled = True Then
SavePicture Picture1.Image, FileName
End If
'If Command2.Enabled = True And Command6.Enabled = True Then
'SavePicture Pic1.Image And Picture1.Image, FileName
'End If
End Sub
请帮我修改一下我打'里面的这几句,实现同时按下按钮保存两幅画 展开
5个回答
展开全部
运行两次SavePicture
但需要重命名FileName
Dim FileName1 As String
FileName1 = Mid(FileName, 1, InStrRev(FileName, ".") - 1) & "1" & Mid(FileName, InStrRev(FileName, "."))
SavePicture Picture1.Image, FileName
SavePicture Picture1.Image, FileName1
程序运行解释
这里假设
FileName = "C:\Program Files\Thunder\Thunder.jpg"
那么
FileName1 = "C:\Program Files\Thunder\Thunder1.jpg"
但需要重命名FileName
Dim FileName1 As String
FileName1 = Mid(FileName, 1, InStrRev(FileName, ".") - 1) & "1" & Mid(FileName, InStrRev(FileName, "."))
SavePicture Picture1.Image, FileName
SavePicture Picture1.Image, FileName1
程序运行解释
这里假设
FileName = "C:\Program Files\Thunder\Thunder.jpg"
那么
FileName1 = "C:\Program Files\Thunder\Thunder1.jpg"
展开全部
有个笨方法,比较直观些?
If Command2.Enabled = True And Command6.Enabled = True Then
SavePicture Pic1.Image, FileName
SavePicture Picture1.Image, FileName
elseIf Command6.Enabled = True Then
SavePicture Picture1.Image, FileName
elseif Command2.Enabled = True then
SavePicture Pic1.Image, FileName
End If
还有个方法
dim flag
flag=0
if Command2.Enabled =true then flag=flag+1
if Command6.Enabled =true then flag=flag+2
select case flag
case is =1: SavePicture Pic1.Image, FileName
case is =2: SavePicture Pic2.Image, FileName
case is =3:
SavePicture Pic1.Image, FileName
SavePicture Pic2.Image, FileName
end select
还有个方法
if Command2.Enabled =true then SavePicture Pic1.Image, FileName
if Command6.Enabled =true then SavePicture Pic2.Image, FileName
控件名和文件名 搞清楚就行
If Command2.Enabled = True And Command6.Enabled = True Then
SavePicture Pic1.Image, FileName
SavePicture Picture1.Image, FileName
elseIf Command6.Enabled = True Then
SavePicture Picture1.Image, FileName
elseif Command2.Enabled = True then
SavePicture Pic1.Image, FileName
End If
还有个方法
dim flag
flag=0
if Command2.Enabled =true then flag=flag+1
if Command6.Enabled =true then flag=flag+2
select case flag
case is =1: SavePicture Pic1.Image, FileName
case is =2: SavePicture Pic2.Image, FileName
case is =3:
SavePicture Pic1.Image, FileName
SavePicture Pic2.Image, FileName
end select
还有个方法
if Command2.Enabled =true then SavePicture Pic1.Image, FileName
if Command6.Enabled =true then SavePicture Pic2.Image, FileName
控件名和文件名 搞清楚就行
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
关键是你就一个文件名,要输出成两个文件怎么行?
你可以让用户选择文件名 如a.jpg
然后Command2.Enabled = True 保存
a.jpg
然后Command6.Enabled = True 保存
a2.jpg
你可以让用户选择文件名 如a.jpg
然后Command2.Enabled = True 保存
a.jpg
然后Command6.Enabled = True 保存
a2.jpg
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
'可以这样子,不过VB保存图片的格式是BMP文件
CommonDialog1.Filter = "JPG文件|*.JPG|所有文件|*.*"
If Command2.Enabled = True Then
CommonDialog1.ShowSave
FileName = CommonDialog1.FileName
SavePicture Pic1.Image, FileName
End If
If Command6.Enabled = True Then
CommonDialog1.ShowSave
FileName = CommonDialog1.FileName
SavePicture Picture1.Image, FileName
End If
CommonDialog1.Filter = "JPG文件|*.JPG|所有文件|*.*"
If Command2.Enabled = True Then
CommonDialog1.ShowSave
FileName = CommonDialog1.FileName
SavePicture Pic1.Image, FileName
End If
If Command6.Enabled = True Then
CommonDialog1.ShowSave
FileName = CommonDialog1.FileName
SavePicture Picture1.Image, FileName
End If
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你现在就是两个都为 True 时就能保存两个图片啦。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询