/// <summary> /// Toggle the draw demo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonDrawDemo_Click(object sender, EventArgs e) { if (_drawDemo == null) { _drawDemo = new DrawDemo(_touchlessMgr, pictureBoxDisplay.Bounds); buttonDrawDemo.Text = "Stop Draw Demo"; buttonSnakeDemo.Enabled = buttonImageDemo.Enabled = buttonDefendDemo.Enabled = false; labelDemoInstructions.Enabled = true; labelDemoInstructions.Text = "Drawing Demo Instructions:\n\n" + "Use one or more markers to draw on a canvas.\n" + "Change a marker's visible size to change its drawing width.\n" + " Bring a marker closer to or farther from the camera.\n" + " Hide or expose parts of a marker.\n\n" + "Hide the entire marker to prevent it from drawing:\n" + " With a marker on your finger, 'click' to hide.\n" + " Use a marker on your thumb and hide it with your fingers.\n\n" + "Can you extend this demo to make a small version of paint?\n" + "Can you think of better ways to 'click'?\n\n" + "Give feedback, submit code, join the community, and more:\n" + "http://www.codeplex.com/touchless"; } else { _drawDemo.Dispose(); _drawDemo = null; buttonDrawDemo.Text = "Start Draw Demo"; buttonSnakeDemo.Enabled = buttonImageDemo.Enabled = buttonDefendDemo.Enabled = true; labelDemoInstructions.Enabled = false; labelDemoInstructions.Text = ""; } }
/// <summary> /// Toggle the draw demo /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonDrawDemo_Click(object sender, EventArgs e) { if (_drawDemo == null) { _drawDemo = new DrawDemo(_touchlessMgr, pictureBoxDisplay.Bounds); buttonSaveImage.Visible = true; buttonLoadImage.Visible = true; buttonDrawDemo.Text = "Stop Drawing"; buttonDrawDemo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(232)))), ((int)(((byte)(93)))), ((int)(((byte)(92))))); buttonSnakeDemo.Enabled = buttonImageDemo.Enabled = buttonDefendDemo.Enabled = false; labelDemoInstructions.Enabled = true; labelDemoInstructions.Text = "Drawing Demo Instructions:\n\n" + "Use one or more markers to draw on a canvas.\n" + "Change a marker's visible size to change its drawing width.\n" + " Bring a marker closer to or farther from the camera.\n" + " Hide or expose parts of a marker.\n\n" + "Hide the entire marker to prevent it from drawing:\n" + " With a marker on your finger, 'click' to hide.\n" + " Use a marker on your thumb and hide it with your fingers.\n\n" + "Can you extend this demo to make a small version of paint?\n" + "Can you think of better ways to 'click'?\n\n" + "Give feedback, submit code, join the community, and more:\n" + "http://www.codeplex.com/touchless"; } else { //Bitmap camera_screen = _touchlessMgr.CurrentCamera.GetCurrentImage(); //Bitmap canvas = _drawDemo.Canvas; _drawDemo.Dispose(); /*using (Graphics grfx = Graphics.FromImage(camera_screen)) * { * grfx.DrawImage(canvas, 0, 0); * } * pictureBoxDisplay.Image = canvas;*/ _drawDemo = null; buttonDrawDemo.Text = "Start Drawing"; buttonDrawDemo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(92)))), ((int)(((byte)(232)))), ((int)(((byte)(134))))); buttonSnakeDemo.Enabled = buttonImageDemo.Enabled = buttonDefendDemo.Enabled = true; labelDemoInstructions.Enabled = false; labelDemoInstructions.Text = ""; buttonSaveImage.Visible = false; buttonLoadImage.Visible = true; } }