大家好,小阳来为大家解答以上的问题。transparentblt drawitem这个很多人还不知道,现在让我们一起来看看吧!
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 LongPrivate Sub Form_Load()GdiTransparentBlt Me.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &HFF00FFEnd Sub这是效果,不知道有没有被百度给黑了,你可以试试。
2、有什么不明白可以追问以下代码可使窗口中的纯蓝色(&HFF0000)变为透明:Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal HWnd As Long, ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal HWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal HWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongPrivate Const WS_EX_LAYERED = &H80000Private Const GWL_EXSTYLE = (-20)Private Const LWA_ALPHA = &H2Private Const LWA_COLORKEY = &H1Private Sub Form_Load() Dim rtn As Long rtn = GetWindowLong(Me.HWnd, GWL_EXSTYLE) Or WS_EX_LAYERED SetWindowLong Me.HWnd, GWL_EXSTYLE, rtn SetLayeredWindowAttributes Me.HWnd, &HFF0000, 0, LWA_COLORKEYEnd Sub在VB.NET中很容易的,用不着API的大驾。
本文到此分享完毕,希望对大家有所帮助。
标签:
版权声明:本文由用户上传,如有侵权请联系删除!