Results 1 to 4 of 4

Thread: transparency

  1. #1

    Thread Starter
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872

    transparency

    I tried to make 1 color of an image trasparent in VB.Net. But it just changes that color in the form background color. In VB6 it was possible to use a gif with a transparent color, but that doesnt work either. Can someone help me with this?

  2. #2
    Fanatic Member MoMad's Avatar
    Join Date
    Oct 2000
    Location
    Seattle, WA
    Posts
    625
    Erm...

    I dont know .Net just yet, but have you tried using GDI+? There is something like bitblt but i dont know what its called, and you tell it a mask color, and it just makes that color transparent.

    check out:
    http://www.allapi.net/ or http://www.vbapi.com/

    For some info on BitBlt and its .Net version (it could be called something else).

    Regards,
    MoMad
    :MoMad:
    Nice Sig!

    http://go.to/momad/ Status: Not Ready

  3. #3
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    The function is called TransBlt
    But don't use it too much, it's known for causing memory leaks.

    This function will allow you to draw to your form (or a picturebox) once (auto-redraw should be set to False or it won't draw at all). Your best bet is to draw it on the form's Paint event, so that every time the form repaints itself and its controls it also repaints the image. You can't reposition the image like a control, you'll have to know its coordinates (Left (X) and Top (Y) ). I guess that's all... it's not that hard, try one of the sites they should have all the info you need
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  4. #4
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    I use transblit but you gotta really know how to kill your objects to use it. I suggest debugwriting objectcreated = objectcreated+1 for every time you create anything and objectcreated = objectcreated-1 for every time you kill something. Using this I found I was not using transblit correctly and was able to address my code accordingly. I can now loop through it from now untill next month without loosing any resources.

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