Ejemplo n.º 1
0
        void SetSlidersandInitialValue(PixeLINK.Feature feature, Slider slider, TextBox box, float multiplier)
        {
            CameraFeature features = cam.GetFeature(feature);

            if (!features.IsSupported)
            {
                slider.IsEnabled = false;
                return;
            }
            slider.Minimum = features.parameters[0].MinimumValue * multiplier;
            slider.Maximum = features.parameters[0].MaximumValue * multiplier;
            ReturnCode rc = cam.GetFeatureByParms(feature, ref flags, ref parms);

            box.Text = (parms[0] * multiplier).ToString();
        }
Ejemplo n.º 2
0
        private void Preview_Loaded(object sender, RoutedEventArgs e)
        {
            _ROIoriginalLeft = Canvas.GetLeft(roi);
            _ROIoriginalTop  = Canvas.GetTop(roi);

            roi.MouseMove           += new MouseEventHandler(Window1_MouseMove);
            roi.MouseLeftButtonDown += new MouseButtonEventHandler(Window1_MouseLeftButtonDown);
            roi.MouseLeftButtonUp   += new MouseButtonEventHandler(DragFinishedMouseHandler);
            this.KeyDown            += new KeyEventHandler(roi_KeyDown);
            roi.Focusable            = true;
            //get the max roi for camera
            CameraFeature features = cam.GetFeature(PixeLINK.Feature.Roi);

            if (!features.IsSupported)
            {
                Reset.IsEnabled = false;
            }
            else
            {
                string temp = string.Format("{0}", features.parameters[2].MaximumValue);
                temp         += " X ";
                temp         += string.Format("{0}", features.parameters[3].MaximumValue);
                Reset.Content = temp;
            }
            //get the current roi
            ReturnCode rc = cam.GetFeatureByParms(Feature.Roi, ref flags, ref RoiSizes);

            startRoiSizes = RoiSizes;
            top.Text      = startRoiSizes[(int)rectSides.top].ToString();
            left.Text     = startRoiSizes[(int)rectSides.left].ToString();
            width.Text    = startRoiSizes[(int)rectSides.width].ToString();
            height.Text   = startRoiSizes[(int)rectSides.height].ToString();
            selected      = true;

            e.Handled = true;
        }