How to load multiple images on the form?

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2007
Posts: 29
Reputation: shsh_shah is an unknown quantity at this point 
Solved Threads: 0
shsh_shah shsh_shah is offline Offline
Light Poster

How to load multiple images on the form?

 
0
  #1
May 17th, 2007
Hi,
I have one form which is login form which contains username and image browsing field. Now in

Login.cs

  1. private void LoadGameButton_Click(object sender, EventArgs e)
  2. {
  3. TicTacToe tic=new TicTacToe(usernametextBox.Text,imgTextbox.Text);
  4. if (imgTextbox.Text.Equals(""))
  5. {
  6. MessageBox.Show("Please select any image");
  7. return;
  8. }
  9. else
  10. {
  11. tic.Show();
  12. // this.Hide();
  13. }
  14. }

In TicTacToe.cs

  1. public TicTacToe(String strText,string img)
  2. {
  3. InitializeComponent();
  4. if (strText.Equals(""))
  5. {
  6. label2.Text = "Guest";
  7. }
  8. else
  9. {
  10. label2.Text = strText;
  11.  
  12. }
  13.  
  14. pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
  15. //pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
  16.  
  17. pictureBox1.Load(img);
  18. pictureBox1.Refresh();
  19. }

Question is:
I defined two picturebox fields on this form where i can load 2 people images but now how to write the code so that once the user is logged in image will come in one picturebox and when second user is logged in it will come in second picturebox and after that login form should be hidden.

Please help?
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 436
Reputation: JerryShaw is on a distinguished road 
Solved Threads: 72
JerryShaw JerryShaw is offline Offline
Posting Pro in Training

Re: How to load multiple images on the form?

 
0
  #2
May 19th, 2007
There seems to be a lot of gaps in your question, but I will take a stab at it. You have a load Game button and you need player 1 and Player 2 to login. I assume both login on the same form while it is open. Once both players are selected, then you want to instantiate the game and have those players pictures appear on the main screen (the Game).

First, do not instantiate TicTacToe until you have both players assigned with names and images on this login screen. So disable the loadgame button until both players are set. Then when you instantiate TicTacToe from the loadgame event handler, provide 4 parameters (both player names and images) instead of just two.

Does that make sense ?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC