//Take a snapshot from the camera when button is clicked private void takePictureButton_Click(object sender, EventArgs e) { //If the live preview is on, turn it off while we take the picture bool checkBoxChecked = displayLivePreviewCheckBox.Checked; if (checkBoxChecked) { //Tell the thread to stop displayLivePreviewCheckBox.Checked = false; //Wait for it to stop while (backgroundWorking) { } } //Take a picture and set it to the Picture Box image. //The parameter is the shutter speed value between 0 and 4096 imagePreviewPictureBox.Image = theCamera.AquireBitmapImage(3000); //Check for pins CheckAllPinsButton.PerformClick(); //Refresh the picture box so that the image is displayed imagePreviewPictureBox.Refresh(); //Refersh the histogram so that it is displayed (see pictureBox2_paint) histogramPictureBox.Refresh(); //Restore the checkbox to whatever it was before displayLivePreviewCheckBox.Checked = checkBoxChecked; }
private void PalletPosDefaultButton_Click(object sender, EventArgs e) { // Returns pallet location to default (256, 133) PalletXPosTextBox.Text = 256.ToString(); PalletYPosTextBox.Text = 113.ToString(); // Refresh position imagePreviewPictureBox.Refresh(); // Check pins CheckAllPinsButton.PerformClick(); // Refresh again to redraw imagePreviewPictureBox.Refresh(); }
private void imagePreviewPictureBox_MouseClick(object sender, MouseEventArgs e) { // Gets cursor position over the picture // to set new pallet location PalletXPosTextBox.Text = (e.X).ToString(); PalletYPosTextBox.Text = (e.Y).ToString(); // Refresh position imagePreviewPictureBox.Refresh(); // Check pins CheckAllPinsButton.PerformClick(); // Refresh again to redraw imagePreviewPictureBox.Refresh(); }