VB 6。0 API GdiTransparentBlt函数调用方面的问题
时间:2011-12-19
来源:互联网
VB 6。0 API
GdiTransparentBlt函数调用方面的问题
我的目的是想调用一下函数,把图片框中1中的图片画到窗体1中,很简单的,请大家看看哪里出了问题....
Private Declare Function GdiTransparentBlt Lib "gdi32" (ByVal hdc1 As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal W1 As Long, ByVal H1 As Long, ByVal Hdc2 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal W2 As Long, ByVal H2 As Long, ByVal Color As Long) As Long '声明
Private Sub Command1_Click()
Main.Cls
n = GdiTransparentBlt(Form1.hDC, 0, 0, Form1.Picture1.Width, Form1.Picture1.Height, Form1.Picture.hDC, 0, 0, Form1.Picture1.Width, Form1.Picture1.Height, RGB(255, 255, 255)) '在窗口中画上图片框中的图片
End Sub
结果窗体中没有任何反应,请大家帮帮忙吧,谢谢大家了
GdiTransparentBlt函数调用方面的问题
我的目的是想调用一下函数,把图片框中1中的图片画到窗体1中,很简单的,请大家看看哪里出了问题....
Private Declare Function GdiTransparentBlt Lib "gdi32" (ByVal hdc1 As Long, ByVal x1 As Long, ByVal y1 As Long, ByVal W1 As Long, ByVal H1 As Long, ByVal Hdc2 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal W2 As Long, ByVal H2 As Long, ByVal Color As Long) As Long '声明
Private Sub Command1_Click()
Main.Cls
n = GdiTransparentBlt(Form1.hDC, 0, 0, Form1.Picture1.Width, Form1.Picture1.Height, Form1.Picture.hDC, 0, 0, Form1.Picture1.Width, Form1.Picture1.Height, RGB(255, 255, 255)) '在窗口中画上图片框中的图片
End Sub
结果窗体中没有任何反应,请大家帮帮忙吧,谢谢大家了
作者: luoxinxin1988 发布时间: 2011-12-19
VB code
'Example Name:GdiTransparentBlt 'This project needs 2 pictureboxes 'Picturebox1 must contain a picture with a lot of white pixels (we're going to use white as transparent color) Private Declare Function GdiTransparentBlt Lib "gdi32.dll" (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 crTransparent As Long) As Boolean Private Sub Form_Load() 'KPD-Team 2001 'URL: http://www.allapi.net/ 'E-Mail: [email protected] Picture1.AutoSize = True 'API uses pixels Picture1.ScaleMode = vbPixels Picture2.ScaleMode = vbPixels End Sub Private Sub Picture2_Paint() 'If we don't call DoEvents first, our transparent image will be completely wrong DoEvents GdiTransparentBlt Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, vbWhite End Sub
作者: Veron_04 发布时间: 2011-12-19
你form1的autoredraw要设为ture才行.
作者: dafu2003 发布时间: 2011-12-19
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28