private void button1_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { Test t = (Test)listBox1.Items[(listBox1.SelectedIndex)]; TestHelper testHelper = new TestHelper(t); TestFrame testframe = new TestFrame(testHelper, usermanager.getUser("andrew").Id); testframe.Show(); } else { MessageBox.Show("Please select a test from the list"); } }
public TestFrame(TestHelper t, int userid) { test = t; InitializeComponent(); context = BufferedGraphicsManager.Current; context.MaximumBuffer = new Size(this.Width + 1, this.Height + 1); grafx = context.Allocate(this.CreateGraphics(), new Rectangle(0, 0, this.Width, this.Height)); renderer = new Renderer(grafx); box = new Box(renderer, 20, 20); box.X = 150; box.Y = 300; userInput = new StringBuilder(); this.userid = userid; instance = this; numberEntered = true; timer = new System.Windows.Forms.Timer(); timer.Interval = 1000; timer.Tick += new EventHandler(this.OnTimer); }