VB问题,这段代码是问题在·什么地方?
PrivateDeclareFunctionStretchBltLib"gdi32"(ByValhdcAsLong,ByValXAsLong,ByValYAsLong,B...
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Sub Command1_Click()
Picture2.Refresh
'Picture1 = Clipboard.GetData
StretchBlt Picture2.hdc, 0, 0, Picture2.Width - Text2.Text, Picture2.Height - Text1.Text, Picture1.hdc, 0, 0, Picture1.Width, Picture1.Height, vbSrcCopy
Clipboard.Clear
Clipboard.SetData Picture2, vbCFBitmap
End Sub
我的目的是要将Picture2中的图放入剪贴板中,以便粘贴到WORD中去,但我发现执行后,剪贴板内是空的。 展开
Private Sub Command1_Click()
Picture2.Refresh
'Picture1 = Clipboard.GetData
StretchBlt Picture2.hdc, 0, 0, Picture2.Width - Text2.Text, Picture2.Height - Text1.Text, Picture1.hdc, 0, 0, Picture1.Width, Picture1.Height, vbSrcCopy
Clipboard.Clear
Clipboard.SetData Picture2, vbCFBitmap
End Sub
我的目的是要将Picture2中的图放入剪贴板中,以便粘贴到WORD中去,但我发现执行后,剪贴板内是空的。 展开
2个回答
展开全部
Private Sub Command1_Click()
Picture2.AutoRedraw = True
'Picture1 = Clipboard.GetData
StretchBlt Picture2.hdc, 0, 0, Picture2.Width - Text2.Text, Picture2.Height - Text1.Text, Picture1.hdc, 0, 0, Picture1.Width, Picture1.Height, vbSrcCopy
Clipboard.Clear
Clipboard.SetData Picture2.Image
End Sub
这样才可以得到图像。
Picture2.AutoRedraw = True
'Picture1 = Clipboard.GetData
StretchBlt Picture2.hdc, 0, 0, Picture2.Width - Text2.Text, Picture2.Height - Text1.Text, Picture1.hdc, 0, 0, Picture1.Width, Picture1.Height, vbSrcCopy
Clipboard.Clear
Clipboard.SetData Picture2.Image
End Sub
这样才可以得到图像。
更多追问追答
追问
没用,你说的方法没用,还是没有图像。
追答
怎么会,有图有真相,这是执行完程序,把剪贴板的内容粘贴到画图里面:
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询