I'm new here, and I'm kinda new to programming as well. I wrote a euchre program as a command line program, and I am converting it to a Windows program. For those who don't know, euchre is a card game involving 3-7 players (most commonly 4) which is most commonly played in the NE US.
(http://en.wikipedia.org/wiki/Euchre)
A little background on me - This is my first Windows program, and I am learning as I go. I learned C++ in college, and was only taught command-line programming. I originally wrote this program in C++ as a command-line program, and I converted it to C# for the GUI version. I learned the differences from C++ to C# through an eBook that I found, and from searching Google for any specific information I need to know.
So now to the issue... I want to make it so that when a player puts the mouse over a card to select which card to play, the card raises up a little, (right now I have it moving up 30 pixels) and then lowers when the mouse is moved, or the card is selected. I have it working fairly well right now, but when the mouse is placed over the bottom 30 pixels of the card, it bounces up and down repeatedly.
I am using PictureBoxes to display the cards, and when the mouse is over the box I change the Y location of the box by -30. I tried moving the box and making it 30 pixels taller, but when I do that, the table top is shown through the bottom of the box, instead of the card behind the selected card.
I have been playing with so many ways to fix this issue, and I have run out of ideas. Any help would be much appreciated!
If you would like to check out the program, and see specifically what I am talking about, you can find it at [REDACTED] (it is kept in my dropbox public folder)
This is the code: (p1c1 is a PictureBox that represents the first card in player 1's hand)
//player 1 card 1, mouse over
private void p1c1_MouseEnter(object sender, EventArgs e)
{
//move card up 30 pixels
Point point = new Point();
point.X = this.p1c1.Location.X;
point.Y = this.p1c1.Location.Y - 30;
this.p1c1.Location = point;
}
//player 1 card 1, mouse leave
private void p1c1_MouseLeave(object sender, EventArgs e)
{
//move card down 30 pixels
Point point = new Point();
point.X = this.p1c1.Location.X;
point.Y = this.p1c1.Location.Y + 30;
this.p1c1.Location = point;
}