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
结果窗体中没有任何反应,请大家帮帮忙吧,谢谢大家了
解决方案 »
- VB调用API的编译问题
- VB6.0动态加载用户开发的OCX控件,当控件超过一定数量时就出现加载错误,是内存限制还是什么原因啊?
- 什么是插件?
- 如何在DateCombo中允许使用鼠标滚轮?
- 关于stream对象的小问题
- 请问怎样把查询到的记录生成*.TXT文件
- 怎么Image控件绑定Access2000数据库中的图片?
- 谁能给我讲讲Set语句吗?它有些什么作用呢?怎么用的?最好是在不同场合分别用到它,都加一个实例??
- VB显示shell的输出,程序被挂起怎么办,有一段中间人程序C我在TC2下编译不通过,有没有好的办法
- 关于shell32.dll的问题
- "编程错误,程序太大“求解决方法!谢谢!!!
- 使用vb.net tts转换文本为wav时,下面的源代码如何写??????????
'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