How do you use true transparency in .Net (VB)?

Zac Mckraken 25 Reputation points

I have been trying to make a program in VB where several images need to be overlapped and dragged around the screen, I have tried using a PictureBox and a panel. However, when using a PNG with transparency, it does not seem to work correctly.


It simply shows the background rather than being transparent and showing the pictures below.

I can make the "flag" a child of one of the pictures which will result in this:


But this cuts off the flags, so that won't work.

Alternatively, I tried using Graphics to draw the images. This solves the problem of transparency so it looks as it should.


But this requires me to redraw the images every time they are dragged, which causes a lot of flickering.

I don't need to manipulate the images or anything, simply to be able to load them and drag them around. Is there really no easy way to do that in Visual Studio? or am I forced to use DirectX or some other means of doing this, because it kind of feels like shooting flies with cannons?

It seems like a very strange way Visual Studio handles transparency in general and have a difficult time understanding why anyone would ever choose to use a transparent image and then not want it to be truly transparent.

An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,637 questions
{count} votes

Accepted answer
  1. Castorix31 82,656 Reputation points

    I just uploaded a simple class from UserControl, to be improved :

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful