| | |
How to load multiple images on the form?
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
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 animation array barchart bitmap box broadcast c# check checkbox client code combobox control conversion csharp custom database datagrid datagridview dataset datastructure datetime degrees development directrobot display draganddrop drawing encryption enum excel file form format formbox forms function gdi+ hash image index input install java label list listbox mandelbrot math mouseclick mp3 mysql native networking operator packaging path photoshop picturebox pixelinversion post print process programming radians regex remoting richtextbox safari server sleep snooze socket sql statistics stream string table tables tcp text textbox thread time timer treeview update usercontrol usercontrols validation visualstudio webbrowser wfa windows winforms wpf xml





