the Code is simple. It does not explain how VB achieves the semi-transparent superposition of two images.
Option explicit </P> <p> private declare function createcompatibledc lib "GDI32" (byval HDC as long) as long <br/> private declare function deletedc lib "GDI32" (byval HDC as long) As long <br/> private declare function SelectObject lib "GDI32" (byval HDC as long, byval hobject as long) As long <br/> private declare function deleteobject lib "GDI32" (byval hobject as long) as long <br/> private 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 </P> <p> private sub form_load () <br/> dim w as long, H as long <br/> dim pic1 as stdpicture, pic2 as stdpicture <br/> dim hmemdc1 as long, hmemdc2 as long <br/> dim holdbmp1 as long, holdbmp2 as long </P> <p> set pic1 = loadpicture ("C:/pic1.jpg") <br/> hmemdc1 = createcompatibledc (Me. HDC) <br/> holdbmp1 = SelectObject (hmemdc1, pic1.handle) </P> <p> set pic2 = loadpicture ("C:/pic2.jpg ") <br/> W = me. scalex (pic2.width, vbhimetric, vbpixels) <br/> H = me. scaley (pic2.height, vbhimetric, vbpixels) <br/> hmemdc2 = createcompatibledc (Me. HDC) <br/> holdbmp2 = SelectObject (hmemdc2, pic2.handle) <br/> alphablend hmemdc1, 0, 0, W, H, hmemdc2, 0, 0, W, H, 100 * & h10000 </P> <p> deleteobject SelectObject (hmemdc2, holdbmp2) <br/> deletedc hmemdc2 <br/> set pic2 = nothing </P> <p> SelectObject hmemdc1, holdbmp1 <br/> deletedc hmemdc1 <br/> set me. picture = pic1 <br/> set pic1 = nothing <br/> end sub <br/>