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?
Printable View
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?
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
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 ;)
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.