AurosGamma 0 Newbie Poster

Hello there. I'm making a simple Pacman game because I'm practicing C# (I've never programmed in C# before), but I ran into a problem. Here is my code:

void addGhost(object sender, EventArgs ea) {
 	Random random = new Random();
 	int ghostNum = random.Next(5);
	// Here I use and enum I've created before, this enum haves the ghosts names, so I can load the images from the *.resx file

 	Bitmap img = (Bitmap) res.GetObject( Enum.GetName(typeof(ghostName),ghostNum).ToLower());
 	//img.MakeTransparent(img.GetPixel(1,1)); // I'm loading my images from *.png's with transparency already enabled
 	GhostClass aux = new GhostClass(); //Ghost class extends PictureBox
 	aux.Parent = this;
 	aux.Location = new Point(random.Next(512), random.Next(512)); // just random positions
 	aux.Size = new Size(23, 23);
 	aux.BorderStyle = BorderStyle.None;
 	aux.SizeMode = PictureBoxSizeMode.Normal;
 	aux.Image = img;
 	ghostArray.Add(aux); // my ghost array

As you can see, I have a resources file where I have all my loaded images (the map and ghosts, all of them loaded from *.png's), but once the images are shown in the frame, looks like the transparency works only in the grey background of the window application, but not between images.

I have a button to add ghost, so this method is the event function. I hope you can help me, I've searched through the web and I didn't find a specific solution for my problem

For the development I'm using SharpDevelop IDE

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.