| | |
How to load multiple images on the form?
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Mar 2007
Posts: 29
Reputation:
Solved Threads: 0
Hi,
I have one form which is login form which contains username and image browsing field. Now in
Login.cs
In TicTacToe.cs
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?
I have one form which is login form which contains username and image browsing field. Now in
Login.cs
C# Syntax (Toggle Plain Text)
private void LoadGameButton_Click(object sender, EventArgs e) { TicTacToe tic=new TicTacToe(usernametextBox.Text,imgTextbox.Text); if (imgTextbox.Text.Equals("")) { MessageBox.Show("Please select any image"); return; } else { tic.Show(); // this.Hide(); } }
In TicTacToe.cs
C# Syntax (Toggle Plain Text)
public TicTacToe(String strText,string img) { InitializeComponent(); if (strText.Equals("")) { label2.Text = "Guest"; } else { label2.Text = strText; } pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; //pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; pictureBox1.Load(img); pictureBox1.Refresh(); }
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?
•
•
Join Date: Nov 2006
Posts: 436
Reputation:
Solved Threads: 72
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 ?
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 ?
![]() |
Similar Threads
- Random Images on Refresh (JavaScript / DHTML / AJAX)
- load data from access database into form (VB.NET)
- Multiple images to a single bmp/jpg image (Visual Basic 4 / 5 / 6)
- urgent-how to pass multiple values to the parent form (ASP)
- urgent-how to pass multiple values to the parent form (HTML and CSS)
Other Threads in the C# Forum
- Previous Thread: Dropdownlist.... please help
- Next Thread: KeyPress event not working
| Thread Tools | Search this Thread |
.net access algorithm alignment app application array bitmap box c# c#gridviewcolumn check checkbox client color combo combobox communication concurrency control conversion csharp custom data database datagrid datagridview dataset datatable datetime degrees draganddrop drawing enabled encryption enum excel file focus form format forms function gdi+ getoutlookcontactusinfcsvfile globalization hospitalmanagementsystem image input install java list localization mandelbroth math messagebox microsoftc#visualexpress mono mouseclick mysql operator path photoshop picturebox pixelinversion plotting pointer post programming radians read regex remote remoting richtextbox save server sleep socket sql sql-server statistics string stringformatting sun table text textbox thread time timer update usercontrol validate validation visualstudio webbrowser winforms wpf xml





