lundi 23 février 2015

c# windows forms slow picture box

I'm writing a simple Ludus Latrunculorum game for my project at school and am using Picture Boxes in order to represent the pieces for the game.


However, when I use a background image - any background image for panel I'm placing the piece at, it draws them very slowly. As if it places 1 picture top left, then waits about 0.005 and places the next one, until the board is filled. I've tried replacing the background image with a 1x1 white image, same outcome. BUT, when I make the background a colour (this.board.BackColor = Color.Green;) it prints the pieces immediately. Furthermore, when I make the back colour transparent, so I'll see the original background of the whole form, once again, the print is very slow. But when I use Color.Tan, which is my transparency key of the form, I see whatever is behind the form, and the pieces print immediately. Which I find very odd, as I'm guessing it's more difficult for the CPU to fetch whatever is behind the form and print the pieces on it than it is to fetch the background image and print on that.


Why is that happening? How can I make the pictures print immediately?


Aucun commentaire:

Enregistrer un commentaire