View Full Version : Visual Basic .NET Help!!


^DraKe^
4th Feb 2008 Mon, 19:41
Meron bang way na picture box change ko ung opacity or any object na supported any jpeg or png images na pede ko change ung opacity??? Need lang po badly :pray:... Thanks in advance!!

hyperkeios
4th Feb 2008 Mon, 23:36
Meron bang way na picture box change ko ung opacity or any object na supported any jpeg or png images na pede ko change ung opacity??? Need lang po badly :pray:... Thanks in advance!!

oist drake musta na... naks naman nag-vivisual basic dot net ka parin ah... talagang gustong gusto mo pa rin ang I.T... 'ge ingat diyan. ikamusta mo na lang ako kay George Bush, paki-sabi magpapakamot kamo ako ng likod sa kanya. :D -jay from STI

^DraKe^
5th Feb 2008 Tue, 04:22
Hindi ko matapos ung latest project ko eh. Practice lang during spare time. Anyway sino b may alam dyan help naman T_T

hmx_ryan
5th Feb 2008 Tue, 08:35
Hi, what you mean is the Transparency Effect right? If yes then Drawing an entire bitmap with a constant alpha (transparency) is the Best Way...To draw a picture with 50% transparency over another, just start a VB project, add two PictureBoxes, set AutoRedraw to true for each and place images into them... then Add this Codes to your Project:


Private Type BLENDFUNCTION
BlendOp As Byte
BlendFlags As Byte
SourceConstantAlpha As Byte
AlphaFormat As Byte
End Type
' BlendOp:
Private Const AC_SRC_OVER = &H0
' AlphaFormat:
Private Const AC_SRC_ALPHA = &H1

Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)

Private Declare Function AlphaBlend Lib "MSIMG32.dll" ( _
ByVal hdcDest As Long, _
ByVal nXOriginDest As Long, _
ByVal nYOriginDest As Long, _
ByVal nWidthDest As Long, _
ByVal nHeightDest As Long, _
ByVal hdcSrc As Long, _
ByVal nXOriginSrc As Long, _
ByVal nYOriginSrc As Long, _
ByVal nWidthSrc As Long, _
ByVal nHeightSrc As Long, _
ByVal lBlendFunction As Long _
) As Long

Private Sub Form_Paint()
Dim lBlend As Long
Dim bf As BLENDFUNCTION

' Draw the first picture:
bf.BlendOp = AC_SRC_OVER
bf.BlendFlags = 0
bf.SourceConstantAlpha = 255
bf.AlphaFormat = 0
CopyMemory lBlend, bf, 4
AlphaBlend Me.hDC, 0, 0, _
Picture1.ScaleWidth \ Screen.TwipsPerPixelX, _
Picture1.ScaleHeight \ Screen.TwipsPerPixelY, _
Picture1.hDC, 0, 0, _
Picture1.ScaleWidth \ Screen.TwipsPerPixelX, _
Picture1.ScaleHeight \ Screen.TwipsPerPixelY, _
lBlend

' Now draw the second picture with 50% transparency over the top:
bf.SourceConstantAlpha = 128
CopyMemory lBlend, bf, 4
AlphaBlend Me.hDC, 0, 0, _
Picture2.ScaleWidth \ Screen.TwipsPerPixelX, _
Picture2.ScaleHeight \ Screen.TwipsPerPixelY, _
Picture2.hDC, 0, 0, _
Picture2.ScaleWidth \ Screen.TwipsPerPixelX, _
Picture2.ScaleHeight \ Screen.TwipsPerPixelY, _
lBlend

End Sub

^DraKe^
5th Feb 2008 Tue, 11:23
aw WinAPI n pla un. anyway thanks ill try..