Esempio n. 1
0
        public CameraDisplay()
        {
            InitializeComponent();
            CameraDisplaySettings c = (CameraDisplaySettings)SySal.Management.MachineSettings.GetSettings(typeof(CameraDisplaySettings));

            if (c == null)
            {
                c             = new CameraDisplaySettings();
                c.PanelWidth  = 640;
                c.PanelHeight = 480;
                c.PanelTop    = 0;
                c.PanelLeft   = 0;
            }
            StartPosition = FormStartPosition.Manual;
            Left          = c.PanelLeft;
            Top           = c.PanelTop;
            Width         = c.PanelWidth;
            Height        = c.PanelHeight;
            SySal.Imaging.ImageInfo info = new SySal.Imaging.ImageInfo();
            info.BitsPerPixel = 8;
            info.PixelFormat  = SySal.Imaging.PixelFormatType.GrayScale8;
            info.Width        = (ushort)(Width - pnRight.MinimumSize.Width);
            info.Height       = (ushort)(Height - pnBottom.MinimumSize.Height);
            pnRight.Width     = pnRight.MinimumSize.Width;
            pnBottom.Height   = pnBottom.MinimumSize.Height;
            HostedFormat      = info;
            System.Drawing.Bitmap z = new Bitmap(8, 8, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
            GrayScalePalette = z.Palette;
            int i;

            for (i = 0; i < GrayScalePalette.Entries.Length; i++)
            {
                GrayScalePalette.Entries[i] = Color.FromArgb(i, i, i);
            }
        }
Esempio n. 2
0
        public bool EditMachineSettings(Type t)
        {
            CameraDisplaySettings C = (CameraDisplaySettings)SySal.Management.MachineSettings.GetSettings(t);

            if (C == null)
            {
                MessageBox.Show("No valid configuration found, switching to default", "Configuration warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                C             = new CameraDisplaySettings();
                C.Name        = "Default CameraDisplaySettings configuration";
                C.PanelLeft   = 0;
                C.PanelTop    = 0;
                C.PanelWidth  = 640;
                C.PanelHeight = 480;
            }
            EditCameraDisplaySettingsForm ef = new EditCameraDisplaySettingsForm(C);

            if (ef.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    SySal.Management.MachineSettings.SetSettings(t, ef.C);
                    MessageBox.Show("Configuration saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    HostedFormat = m_HostedFormat;
                    return(true);
                }
                catch (Exception x)
                {
                    MessageBox.Show("Error saving configuration\r\n\r\n" + x.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
            }
            return(false);
        }
Esempio n. 3
0
 public override object Clone()
 {
     SySal.Executables.NExTScanner.CameraDisplaySettings C = new CameraDisplaySettings();
     C.PanelWidth  = this.PanelWidth;
     C.PanelHeight = this.PanelHeight;
     C.PanelLeft   = this.PanelLeft;
     C.PanelTop    = this.PanelTop;
     return(C);
 }
Esempio n. 4
0
 private void btnConfigure_Click(object sender, EventArgs e)
 {
     if (EditMachineSettings(typeof(CameraDisplaySettings)))
     {
         CameraDisplaySettings c = (CameraDisplaySettings)SySal.Management.MachineSettings.GetSettings(typeof(CameraDisplaySettings));
         Left         = c.PanelLeft;
         Top          = c.PanelTop;
         Width        = Math.Max(100, c.PanelWidth);
         Height       = Math.Max(100, c.PanelHeight);
         HostedFormat = m_HostedFormat;
     }
 }