http___www.its.edu.rs_programski-jezik-c-13-picture-box-kontrola__1.xml
1.1 1.2 1.3 1.4 2.1 4.1 6.1 8.1 9.1 11.1 13.1 14.1 15.1 15.2 16.1 18.1 20.1 21.1 22.1 26.1 27.1 28.1 29.1 30.1 31.1 32.1 32.2 33.1 34.1
I have multiple forms and i can make them all go to a certain form through the click of one button, but how do I give one button the ability to go back to the last page the user was on, and not just the form before the current one? This is for my 'help' form, as users can visit the form through many other forms. My coding was as follows. I am using Winforms namespace Spanish_Quiz public partial class Help : Form public Help() InitializeComponent(); CenterToScreen(); private void btnBackToStart_Click(object sender, EventArgs e) Homescreen Homescreen = new Homescreen(); Homescreen. Homescreen. Activate(); this. private void btnBack_Click(object sender, EventArgs e) /*This is where my problem is, what code do I write here that could be similar to my 'back to start' button's code?*/ There are several options, i would do it with ShowDialog, before showing the help form, hide the current form, and after closing help form, show the current form again. like this: Form SomeForm { private void OpenHelpForm(object sender, EventArgs e){ this. new Help(). ShowDialog(); //this opens the form and pauses the current form. //when Help form closes, this method continues this.
1.1 2.1 2.2 3.1 4.1 5.1 6.1 7.1 7.2 7.3 7.4 8.1 9.1 9.2 9.3 10.1 11.1 12.1 14.1 15.1 17.1
Zadatak: Napraviti windows aplikaciju, koja će imati jedan PictureBox i jedno dugme. Pri pokretanju aplikacije, slika u picture box-u neće biti vidljiva za korisnika (Slika 1.1): Slika 1.1: Izgled programa Slika u picture box-u postaje vidljiva za korisnika, tek posle pritiska na dugme “Prikazi sliku” (Slika 1.2): Slika 1.2: Izgled programa posle klika na dugme “Prikazi sliku” Rešenje: PictureBox kontrola se dodaje na formu direktnim prevlačenjem iz toolbox-a u design modu. Klikom na strelicu u desnom gornjem uglu PictureBox-a u design modu, otvara se posebni meni PictureBox Tasks. U opciji Size Mode izabrati Stretch Image. Klikom na opciju Choose Image otvara se prozor Select Resource, u kojem se obavlja izbor slike, koja će biti prikazana u PictureBox-u (Slika 1.3): Slika 1.3: Izbor slike u design modu Prozor Select Resource se otvara i ako se u “Properties” prozoru za PictureBox direktno podešava svojstvo Image. S obzirom da je zahtev zadatka da slika na startu ne bude vidljiva za korisnika, potrebno je da se svojstvo Visible postavi na False. Solution explorer treba da izgleda kao na sledećoj slici (Slika 1.4): Slika 1.4: Solution Explorer Kod za dugme “Prikazi sliku”: private void button1_Click(object sender, EventArgs e) // pritiskom na dugme, slika postaje vidljiva za korisnika pictureBox1.Visible = true; Kompletno rešenje zadatka možete da preuzmete ovde.