I want to draw an image over another without drawing its backgroud. The image I want to draw is a star. I want to put some stars above the map image.
The problem is that the star image has a white backgroud, and when I draw over the map, a white background appears.
My star drawing method is as follows:
Graphics graphics = Graphics.FromImage(map);
Image customIcon = Image.FromFile("../../star.png");
graphics.DrawImage(customIcon, x, y);
I tried with transparent backgroud images (PNG and GIF formats) and it always draws something around the star. How to draw a star without a background?
The program is designed for Windows Mobile 5.0 and later with Compact Framework 2.0 SP2 and C #.
I tried with this code:
Graphics g = Graphics.FromImage(mapa);
Image iconoPOI = (System.Drawing.Image)Recursos.imagenPOI;
Point iconoOffset = new Point(iconoPOI.Width, iconoPOI.Height);
System.Drawing.Rectangle rectangulo;
ImageAttributes transparencia = new ImageAttributes();
transparencia.SetColorKey(Color.White, Color.White);
rectangulo = new System.Drawing.Rectangle(x, y, iconoPOI.Width, iconoPOI.Height);
g.DrawImage(iconoPOI, rectangulo, x, y, iconoPOI.Width, iconoPOI.Height, GraphicsUnit.Pixel, transparencia);
But I donβt see anything on the map.
X Y - , iconoPOI, PNG .
!