Private Sub command2_Click()
SavePicture me.image,"c:\abc.bmp"
End Sub
不行的话就用你原来的方法,不过是在你点了那个保存按钮的时候把那两个按钮给隐藏起来,在保存完后再显示出来,你应该知道怎么做吧?
我还是帮你写完整好了,假如两个按钮的名称是command1和command2
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Sub command2_Click()
command1.visiable=false
command2.visiable=false
keybd_event 18, 0, 0, 0
keybd_event vbKeySnapshot, 0&, 0&, 0&
DoEvents
keybd_event 18, 0, KEYEVENTF_KEYUP, 0
SavePicture Clipboard.GetData, "c:\abc.bmp"
command1.visiable=true
command2.visiable=true
End Sub
在拷屏时把按钮隐藏(增加
Command2.Visible = False'
DoEvents'):
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Sub command2_Click()
Command2.Visible = False'
DoEvents'
keybd_event 18, 0, 0, 0
keybd_event vbKeySnapshot, 0&, 0&, 0&
DoEvents
keybd_event 18, 0, KEYEVENTF_KEYUP, 0
SavePicture Clipboard.GetData, "c:\abc.bmp"
Command2.Visible = True
End Sub
'这样再试验一下!~ 应该可以了!~
Private Sub command2_Click()
'add dl_会飞的青蛙 start
command1.visiable=false
command2.visiable=false
'add dl_会飞的青蛙 end
'add dl_会飞的青蛙 start
DoEvents
'add dl_会飞的青蛙 end
keybd_event 18, 0, 0, 0
keybd_event vbKeySnapshot, 0&, 0&, 0&
DoEvents
keybd_event 18, 0, KEYEVENTF_KEYUP, 0
SavePicture Clipboard.GetData, "c:\abc.bmp"
'add dl_会飞的青蛙 start
command1.visiable=true
command2.visiable=true
'add dl_会飞的青蛙 end
End Sub
什么叫恶作剧? 你翻翻我以前的记录,看看有没有过? 我无聊透顶啊?
代码是很简单,不就是保存窗体上的输出的图像吗? 你运行一下我的程序,看看能不能保存,看看Command1按钮,有没有在程序中出现? 实现了你的要求,居然还说我在恶作剧!!!!!
提个问题,还匿名,是谁见不得人啊?
随便给你一条忠告,不是用了API就了不起,有些功能,不用API也照样搞定,而且还简单!!
Keybd_event谁不知道,谁不会用,关键是不是一定需要在这儿用
关键性的东西不看,只看到我中间随机生成图像的内容!
最后说一句:以后匿名提问的,一概不回答
试试SavePicture方法
Private Sub Command1_Click()
Randomize
Form1.AutoRedraw = True
'下面的是随机生成一些图像,换成你的事件代码,如果有其它地方生成图像,删除此处,直接保存
For i = 1 To 100
Form1.Circle (Int(Rnd * Form1.ScaleWidth), Int(Rnd * Form1.ScaleHeight)), Int(Rnd * 1000) + 1000, QBColor(Int(Rnd * 16))
Next
'随机生成图像结束,下面的是保存
SavePicture Form1.Image, "c:\a.bmp"
End Sub