Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Thu, 15 May 2008 14:58:01 -0700,    group: microsoft.public.win32.programmer.gdi        back       


(.NET/GDI/BitBlt) Bitmap does not appear correctly using BitBlt   
I have the following code which works fine and puts a transparent image onto 
an image in a Picturebox. The Mask and Src Images are both In PictureBoxes

    Private bmpConv As Bitmap = Nothing
    Private bmpBtl As Bitmap = Nothing
    Private bmpBtlMask As Bitmap = Nothing

           bmpConv = Image.FromFile("..\Images\Conveyor.bmp")
            pbConv.BackgroundImage = bmpConv

            bmpBtl = Image.FromFile("..\Images\Mist50White.bmp")
            pbBtl.BackgroundImage = bmpBtl

            bmpBtlMask = Image.FromFile("..\Images\Mist50Mask.bmp")
            pbBtlMask.BackgroundImage = bmpBtlMask


MyBitBlt(pbConv, pbBtl, pbBtlMask, 0, 0)

    Public Sub MyBitBlt(ByVal Dst As PictureBox, ByVal Src As PictureBox, 
ByVal Mask As PictureBox, ByVal X As Long, ByRef Y As Long)
        ' Get device context of source and destination picture boxes
        Dim srcHDC As IntPtr = Src.CreateGraphics.GetHdc
        Dim dstHDC As IntPtr = Dst.CreateGraphics.GetHdc
        Dim maskHDC As IntPtr = Mask.CreateGraphics.GetHdc

        BitBlt(dstHDC.ToInt32, X, Y, 50, 50, maskHDC.ToInt32, 0, 0, 
TernaryRasterOperations.SRCPAINT)
        'put the picture onto the main screen
        BitBlt(dstHDC.ToInt32, X, Y, 50, 50, srcHDC.ToInt32, 0, 0, 
TernaryRasterOperations.SRCAND)

    End Sub

-- 
IT/Software Dev Manager
date: Thu, 15 May 2008 14:58:01 -0700   author:   Tony (Goody Goody Liquor,Dallas)

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us