ChefBrohan
ChefBrohan

Reputation: 21

C# making tiles in grid class swap

I need to make a slider puzzle game where the tiles swap positions and to win, the tiles need to be in order from 1 to 8. So the winning layout looks like this,

1 2 3
4 5 6          
7 8 (b)

b = blank tile

It is in a 3 by 3 grid with the numbers 1, 2, and 3 on top column and 7, 8, blank on last column.

The numbers are in an imagelist and the imagelist is in a grid in boundedgrid class. The form1 appears as above. I want it so that is u click on tile 6 or tile 8, it will swap tiles with the blank tile. My question was what event do I need to swap tiles in the picturebox? Is it mouseclick...mousedown?

Upvotes: 0

Views: 174

Answers (1)

kennyzx
kennyzx

Reputation: 12993

MouseDown, MouseClick, MouseUp, I think either can do. If you want the swapping begins after mouse is released, then use MouseUp event, the benefit is if user presses the mouse button on the PictureBox but he is not so sure, he can still move the mouse out of the PictureBox before releasing the button, so the MouseUp event will not be fired.

Upvotes: 1

Related Questions