Zed McJack
New member
- Joined
- Oct 16, 2014
- Messages
- 2
- Programming Experience
- 10+
Hi all,
I was going through getting started turorials on MS site as I downloaded C# Express 2010.
Finished second tutorial and wanted to add a couple of things, one of them is timer.
Added timer and it works as expected, but restarting it doesnt work. Dont know what I did wrongly?
I was going through getting started turorials on MS site as I downloaded C# Express 2010.
Finished second tutorial and wanted to add a couple of things, one of them is timer.
Added timer and it works as expected, but restarting it doesnt work. Dont know what I did wrongly?
C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Lavirint
{
public partial class Form1 : Form
{
int ProtekloVreme = 0;
System.Media.SoundPlayer ZidPlejer = new System.Media.SoundPlayer(@"c:\windows\media\ding.wav");
System.Media.SoundPlayer CiljniPlejer = new System.Media.SoundPlayer(@"c:\windows\media\tada.wav");
public Form1()
{
InitializeComponent();
idi_na_pocetak(0);
}
/// <summary>
/// Pomera kursor na početnu poziciju ako
/// igrač dodirne zid
/// </summary>
private void idi_na_pocetak(int Zvuk_ili_ne)
{
lblVreme.Text = "Vreme: 0";
if (Zvuk_ili_ne == 1)
{
ZidPlejer.Play();
}
Point startingpoint = panel1.Location;
startingpoint.Offset(40,40);
Cursor.Position = PointToScreen(startingpoint);
timer1.Enabled = true;
}
private void cilj_MouseEnter(object sender, EventArgs e)
{
CiljniPlejer.Play();
MessageBox.Show("Čestitamo!");
Close();
}
private void zid_MouseEnter(object sender, EventArgs e)
{
idi_na_pocetak(1);
timer1.Enabled = false;
ProtekloVreme = 0;
}
private void brojac(object sender, EventArgs e)
{
ProtekloVreme += 1;
lblVreme.Text = "Vreme: " + ProtekloVreme.ToString();
}
}
}