|
-
Jan 22nd, 2008, 02:59 PM
#1
Thread Starter
Lively Member
[3.0/LINQ] Non-responsive PictureBox?
Hello!
I have yet another problem which I can't seem to solve.
I have a pictureBox update its image to a new one, depending
on whether a boolean is true or false, and whether the first
image equals an already set one.
I can get the images to change, but only if I have a MessageBox.Show()
before my if-else statements.
Any thoughts?
Source: http://monoport.com/6633
Appreciates any help at all!
Cheers,
Zolomon
-
Jan 22nd, 2008, 03:04 PM
#2
Re: [3.0/LINQ] Non-responsive PictureBox?
Could you post only the relevant code here? Its so much easier than looking through all of it.
-
Jan 22nd, 2008, 03:07 PM
#3
Thread Starter
Lively Member
Re: [3.0/LINQ] Non-responsive PictureBox?
Of course, forgot to mention which lines it was, my bad. (:
http://monoport.com/6637
Code:
private void pbx1_Click(object sender, EventArgs e)
{
MessageBox.Show(((PictureBox)sender).Tag.ToString());
if (Check(((PictureBox)sender), imgBoard) == true)
{
if (CheckPlayerState(bPlayerState) == true)
{
((PictureBox)sender).Image = imgPlayer1;
tSSLStatus.Text = "Player 2's turn...";
bPlayerState = false;
}
else if (CheckPlayerState(bPlayerState) == false)
{
((PictureBox)sender).Image = imgPlayer2;
tSSLStatus.Text = "Player 1's turn...";
bPlayerState = true;
}
}
else if (Check(((PictureBox)sender), imgPlayer1))
{
MessageBox.Show("Tile already picked. Repick!");
}
else if (Check(((PictureBox)sender), imgPlayer2))
{
MessageBox.Show("Tile already picked. Repick!");
}
//((PictureBox)sender).Enabled = false;
}
Last edited by Zolomon; Jan 22nd, 2008 at 03:16 PM.
-
Jan 22nd, 2008, 03:21 PM
#4
Re: [3.0/LINQ] Non-responsive PictureBox?
So the image isnt being shown directly? Try calling the picturebox refresh method after setting the image property.
-
Jan 22nd, 2008, 03:24 PM
#5
Thread Starter
Lively Member
Re: [3.0/LINQ] Non-responsive PictureBox?
Forgot to mention that if the MessageBox isn't there, none of the if-else statements execute.
-
Jan 22nd, 2008, 03:28 PM
#6
Re: [3.0/LINQ] Non-responsive PictureBox?
 Originally Posted by Zolomon
Forgot to mention that if the MessageBox isn't there, none of the if-else statements execute.
Have you stepped through the code to see whats really happening?
-
Jan 22nd, 2008, 03:51 PM
#7
Thread Starter
Lively Member
Re: [3.0/LINQ] Non-responsive PictureBox?
I just tried, but I can't really make much out of it. The Image property for the PictureBox that I look at only says System.Drawing.Bitmap (which I think is what I should've looked for), so I couldn't see when it changed or not, or when it should've had opportunity for it..
I could upload the full project in case you feel like digging in to it.
(I'm way more than grateful for the help you've given me so far already!)
-
Jan 22nd, 2008, 04:21 PM
#8
Thread Starter
Lively Member
Re: [3.0/LINQ] Non-responsive PictureBox?
Uploaded source & project to:
http://www.zolomon.eu/misc/TicTacToe.rar if anyone feels like taking a deeper look at my problem. (:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|