home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD13543182001.psc / frmMain.frm (.txt) next >
Encoding:
Visual Basic Form  |  2001-01-08  |  6.0 KB  |  163 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Begin VB.Form frmMain 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Visual Effects #3 - AlphaBlending (by MrHippo"
  6.    ClientHeight    =   5055
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   5175
  10.    ForeColor       =   &H8000000F&
  11.    HasDC           =   0   'False
  12.    Icon            =   "frmMain.frx":0000
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   337
  17.    ScaleMode       =   3  'Pixel
  18.    ScaleWidth      =   345
  19.    ShowInTaskbar   =   0   'False
  20.    StartUpPosition =   2  'CenterScreen
  21.    Begin ComctlLib.Slider barAmount 
  22.       Height          =   2235
  23.       Left            =   4440
  24.       TabIndex        =   2
  25.       Top             =   2520
  26.       Width           =   615
  27.       _ExtentX        =   1085
  28.       _ExtentY        =   3942
  29.       _Version        =   327682
  30.       Orientation     =   1
  31.       LargeChange     =   51
  32.       Max             =   255
  33.       SelStart        =   255
  34.       TickStyle       =   2
  35.       TickFrequency   =   51
  36.       Value           =   255
  37.    End
  38.    Begin VB.PictureBox picDestination 
  39.       AutoRedraw      =   -1  'True
  40.       BackColor       =   &H00FFFFFF&
  41.       BorderStyle     =   0  'None
  42.       Height          =   2235
  43.       Left            =   240
  44.       Picture         =   "frmMain.frx":000C
  45.       ScaleHeight     =   149
  46.       ScaleMode       =   3  'Pixel
  47.       ScaleWidth      =   270
  48.       TabIndex        =   1
  49.       TabStop         =   0   'False
  50.       Top             =   2520
  51.       Width           =   4050
  52.    End
  53.    Begin VB.PictureBox picSource 
  54.       AutoRedraw      =   -1  'True
  55.       AutoSize        =   -1  'True
  56.       BorderStyle     =   0  'None
  57.       Height          =   2235
  58.       Left            =   240
  59.       Picture         =   "frmMain.frx":1F4D
  60.       ScaleHeight     =   149
  61.       ScaleMode       =   3  'Pixel
  62.       ScaleWidth      =   270
  63.       TabIndex        =   0
  64.       TabStop         =   0   'False
  65.       Top             =   2520
  66.       Visible         =   0   'False
  67.       Width           =   4050
  68.    End
  69.    Begin VB.Label Label4 
  70.       Caption         =   "Enjoy, Sveinn R. Sigurdsson, computer engineer at Tal Telecommunications, Iceland (MrHippo)"
  71.       Height          =   615
  72.       Left            =   120
  73.       TabIndex        =   7
  74.       Top             =   2040
  75.       Width           =   4455
  76.    End
  77.    Begin VB.Label Label3 
  78.       Caption         =   "By voting on planet-source-code.com you incourage me, and other programmers in providing you with various coding solutions."
  79.       Height          =   495
  80.       Left            =   120
  81.       TabIndex        =   6
  82.       Top             =   1560
  83.       Width           =   4935
  84.    End
  85.    Begin VB.Label Label2 
  86.       Caption         =   "For any assistance on this or other image related topic, please e-mail to depill2000@hotmail.com"
  87.       Height          =   615
  88.       Left            =   120
  89.       TabIndex        =   5
  90.       Top             =   1080
  91.       Width           =   4935
  92.    End
  93.    Begin VB.Label Label1 
  94.       Caption         =   "Please vote and look out for more samples in the Visual Effects sample series on www.planet-source-code.com."
  95.       Height          =   495
  96.       Left            =   120
  97.       TabIndex        =   4
  98.       Top             =   600
  99.       Width           =   4575
  100.    End
  101.    Begin VB.Label lblInfo 
  102.       BackStyle       =   0  'Transparent
  103.       Caption         =   "AlphaBlending was introduced in Windows 98. The function allows you to change the transparency of an image. "
  104.       BeginProperty Font 
  105.          Name            =   "Tahoma"
  106.          Size            =   8.25
  107.          Charset         =   0
  108.          Weight          =   400
  109.          Underline       =   0   'False
  110.          Italic          =   0   'False
  111.          Strikethrough   =   0   'False
  112.       EndProperty
  113.       Height          =   495
  114.       Left            =   120
  115.       TabIndex        =   3
  116.       Top             =   120
  117.       Width           =   4935
  118.    End
  119. Attribute VB_Name = "frmMain"
  120. Attribute VB_GlobalNameSpace = False
  121. Attribute VB_Creatable = False
  122. Attribute VB_PredeclaredId = True
  123. Attribute VB_Exposed = False
  124. ' ********************************************
  125. ' ** Purpose: Alpha Blending Pictures
  126. ' ** Website : www.svenni.com
  127. ' ** Programmer : Sveinn R. Sigurdsson
  128. ' ** e-mail : depill2000@hotmail.com
  129. ' ********************************************
  130. Option Explicit
  131. ' API DECLARATION [ ALPHA BLEND FUNCTION ]
  132. Private Declare Function AlphaBlend Lib "msimg32" ( _
  133. ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, _
  134. ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, _
  135. ByVal xSrc As Long, ByVal ySrc As Long, ByVal widthSrc As Long, _
  136. ByVal heightSrc As Long, ByVal blendFunct As Long) As Boolean
  137. ' API DECLARATIONS [ COPY MEMORY FUNCTION ]
  138. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
  139. Destination As Any, Source As Any, ByVal Length As Long)
  140. ' TYPE STRUCTURES
  141. Private Type typeBlendProperties
  142.     tBlendOp As Byte
  143.     tBlendOptions As Byte
  144.     tBlendAmount As Byte
  145.     tAlphaType As Byte
  146. End Type
  147. Private Sub barAmount_Scroll()
  148.     ' Procedure Scope Declarations
  149.     Dim tProperties As typeBlendProperties
  150.     Dim lngBlend As Long
  151.         ' Clear the destination picture
  152.     picDestination.Cls
  153.     tProperties.tBlendAmount = 255 - barAmount
  154.     ' Call the 'CopyMemory' with the specified parameters
  155.     CopyMemory lngBlend, tProperties, 4
  156.     ' Blend the pictures together and show them at the specified
  157.     ' location in the specified picture box.
  158.     AlphaBlend picDestination.hDC, 0, 0, picSource.ScaleWidth, picSource.ScaleHeight, _
  159.     picSource.hDC, 0, 0, picSource.ScaleWidth, picSource.ScaleHeight, lngBlend
  160.     ' Refresh the picture box with the new image
  161.     picDestination.Refresh
  162. End Sub
  163.