我想在vb中用API函数来使图片白色背景透明,用了下面的代码,却不管用。怎么回事?高手帮忙改一下,谢谢
模块PublicDeclareFunctionGdiTransparentBltLib"gdi32"(ByValhdc1AsLong,ByValx1AsLong,ByVa...
模块 Public 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 Public Sub Draw() GdiTransparentBlt form1.hDC, 0, 0, form1.picture1.Width, form1.picture1.Height, form1.picture1.hDC, 0, 0, form1.picture1.Width, form1.picture1.Height, RGB(255, 255, 255) '画图 End Sub 窗体 Private Sub Command1_Click() call module1.draw End Sub 各种属性也设好了窗体上有一个图片,还有一个command
展开
1个回答
展开全部
‘1、这些属性 你设好没?
Me.AutoRedraw = True
Me.ScaleMode = 3
Picture1.AutoRedraw = True
Picture1.ScaleMode = 3
’2、然后在 GdiTransparentBlt 函数后面 加上 Me.Refresh
‘3、上面测试通过了 - -
Me.AutoRedraw = True
Me.ScaleMode = 3
Picture1.AutoRedraw = True
Picture1.ScaleMode = 3
’2、然后在 GdiTransparentBlt 函数后面 加上 Me.Refresh
‘3、上面测试通过了 - -
追问
可不可以第二条说的再详细些?最好有代码。谢谢了
追答
GdiTransparentBlt form1.hDC, 0, 0, form1.picture1.Width, form1.picture1.Height, form1.picture1.hDC, 0, 0, form1.picture1.Width, form1.picture1.Height, RGB(255, 255, 255)
‘--就是在这段代码 后面加上 Me.Refresh
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询