private void imageViewer1_RoiChanged(object sender, ContoursChangedEventArgs e) { // Enable the Test Parts button if at least one region is selected. testPartsButton.Enabled = imageViewer1.Roi.Count > 0; // Update the target display. for (int i = 0; i < imageViewer1.Roi.Count; ++i) { // Enable the indicators. GetExpectedTextBox(i).Enabled = true; GetActualTextBox(i).Enabled = true; GetPassFailLed(i).Enabled = true; GetPassFailLed(i).LedColorMode = PassFailLed.ColorMode.RedGreen; // Find the number of edges along the line. This is the expected // number of edges. Collection <PointContour> linePoints = Algorithms.GetPointsOnLine((LineContour)imageViewer1.Roi[i].Shape); Collection <PointContour> edges = Algorithms.SimpleEdge(imageViewer1.Image, linePoints, simpleEdgeOptions); GetExpectedTextBox(i).Text = edges.Count.ToString(); } for (int i = imageViewer1.Roi.Count; i < 5; ++i) { // Disable the indicators. GetExpectedTextBox(i).Text = "0"; GetExpectedTextBox(i).Enabled = false; GetActualTextBox(i).Text = "0"; GetActualTextBox(i).Enabled = false; GetPassFailLed(i).Enabled = false; GetPassFailLed(i).LedColorMode = PassFailLed.ColorMode.RedGray; } }
private void C_RoiChanged(object sender, ContoursChangedEventArgs e) { if (C.Roi.Count > 0) { btnOK.Enabled = true; } else { btnOK.Enabled = false; } }