Results 1 to 4 of 4

Thread: showing pictures with transparent properties

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Location
    South Africa
    Posts
    25
    Is there any way of showing a picture on a form , using a picture that has transparency on it ?
    EG : I created pic in Coreldraw 9 . I want pic to blend in with colors on the form. how do i make the transparency work for me ?

    I DONT want to set the pic's background color to the form's
    background color bcoz the other computers it will run on might have different system colors therefore the pic wont blend in.

    Can any of you guru's out there help with this.

    Thanks
    Go Luke , and may the source be with you.

  2. #2
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Lightbulb

    You have to ways (I know):
    - You can save the picture with the gif extension so it will save the trancparency and then load it to an image control in your vb program. (I don't like this way)

    - Or you can yous the Paintpicture method for a picturebox
    Or you can use the BitBlt API.
    in the last method you need the picture with a black background (it calls the sprite) and another one with the oreginal background but the whole picture will be black (it calls the mask). with merging these two pictures with the form backgrownd it will becomes transparent.

    (I always use the BitBlt API to perform such a thing)

    Hope that helps.
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Location
    South Africa
    Posts
    25
    Thanks for the help .
    I will try it in a future project bcoz i made a really cool
    logo that fits in with all colour schemes.

    could you just show me how to use the paintpicture method for a picturebox please.
    Go Luke , and may the source be with you.

  4. #4
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Cool OK

    Code:
    With Picture1
        .PaintPicture Me.Picture, 0, 0, , , .Left, .Top, .Width, .Height, vbSrcCopy
        .PaintPicture LoadPicture(App.Path & "\Mask.bmp"), 0, 0, , , , , , , vbSrcAnd
        .PaintPicture LoadPicture(App.Path & "\Sprite.bmp"), 0, 0, , , , , , , vbSrcInvert
    End With

    I made a little sample for the PaintPicture method.
    But I would prefer to use the BitBlt function so I add another project called CallDLLs I found it with VB5 samples to the previous one with a BitBlt tutorial wrote by Peter Kuchnio and packeged them all in a zip file and upload them to:
    http://hallohoms.homepage.com/VB/transparent.zip


    About the CallDLLs project, only the two procedures cmdBitBlt_Click and tmrBounce_Timer is what you need for the BitBlt.
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

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