Results 1 to 8 of 8

Thread: Under Application

Hybrid View

  1. #1
    Hyperactive Member Dmitri K's Avatar
    Join Date
    Sep 2002
    Location
    West Palm Beach, FL
    Posts
    444

    Re: Under Application

    yeah on Win 2k and XP it's easy using layers but on win98 there are two ways that I know of. I placed both ways into one function for your choice.

    VB Code:
    1. Option Explicit
    2.  
    3. Public Enum iMode
    4.   AlphaBlendingDLL = 1
    5.   msimg32DLL = 2
    6. End Enum
    7.  
    8. Public Type BLENDFUNCTION
    9.     BlendOp As Byte
    10.     BlendFlags As Byte
    11.     SourceConstantAlpha As Byte
    12.     AlphaFormat As Byte
    13. End Type
    14.  
    15. Public Declare Function AlphaBlending Lib "Alphablending.dll" _
    16.               (ByVal destHDC As Long, ByVal XDest As Long, ByVal YDest As Long, _
    17.               ByVal destWidth As Long, ByVal destHeight As Long, ByVal srcHDC As Long, _
    18.               ByVal xSrc As Long, ByVal ySrc As Long, ByVal srcWidth As Long, ByVal srcHeight As Long, ByVal AlphaSource As Long) As Long
    19.  
    20. Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
    21. Public Declare Function AlphaBlend Lib "msimg32" (ByVal hDestDC 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 WidthSrc As Long, ByVal HeightSrc As Long, ByVal blendFunct As Long) As Boolean
    22.  
    23. Public Sub Blend(Destination As Object, Source As Object, Amount As Integer, in_iMode As iMode)
    24.  
    25.   Dim bl As BLENDFUNCTION
    26.   Dim bl_lng As Long
    27.  
    28.     If in_iMode = AlphaBlendingDLL Then
    29.       AlphaBlending Destination.hDC, -Destination.Left - 1, -Destination.Top - 1, Source.ScaleWidth, Source.ScaleHeight, Source.hDC, 0, 0, Source.ScaleWidth, Source.ScaleHeight, Amount
    30.     ElseIf in_iMode = msimg32DLL Then
    31.       bl.SourceConstantAlpha = Amount
    32.  
    33.       CopyMemory bl_lng, bl, 4
    34.    
    35.       Destination.Cls
    36.       AlphaBlend Destination.hDC, -Destination.Left - 1, -Destination.Top - 1, Source.ScaleWidth, Source.ScaleHeight, _
    37.                  Source.hDC, 0, 0, Source.ScaleWidth, Source.ScaleHeight, bl_lng
    38.     End If
    39.    
    40.     Destination.Refresh
    41.  
    42. End Sub

    Use Blend PictureDestination, PictureSource, 120, AlphaBlendingDLL for the 1st method
    Use Blend PictureDestination, PictureSource, 120, msimg32DLL for the 2nd method

    Make sure all pictureboxes are set to autoredraw and are scaled in pixels. Also you SHOULD have msimg32.dll on your pc, but you might not have Alphablending.dll, so i'll attach it. Put the Alphablending.dll into your system folder. Also source and destination could be a form, not a picturebox but make sure autoredraw is on and form is scaled to pixels.
    Attached Files Attached Files
    Last edited by Dmitri K; Jan 3rd, 2005 at 08:31 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width