private void FormAutoScale_Shown(object sender, EventArgs e)
        {
            // ket noi dau can
            setSerialPortCOM();
            Thread thread = new Thread(new ThreadStart(showWeightThread));

            thread.IsBackground = true;
            thread.Start();

            // xy ly camera
            ProtectedPictureBox pictureBox1 = new ProtectedPictureBox();

            pictureBox1.Name     = "cam1";
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox1.Dock     = System.Windows.Forms.DockStyle.Fill;
            pictureBox1.Image    = Properties.Resources.camera;
            tableLayoutPanel1.Controls.Add(pictureBox1, 0, 1);
            camTruoc = new Camera(ConfigurationManager.AppSettings.Get("cam1"), pictureBox1); // HIKVISION Camera
            camTruoc.StartCapture();

            ProtectedPictureBox pictureBox2 = new ProtectedPictureBox();

            pictureBox2.Name     = "cam2";
            pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox2.Dock     = System.Windows.Forms.DockStyle.Fill;
            pictureBox2.Image    = Properties.Resources.camera;
            tableLayoutPanel1.Controls.Add(pictureBox2, 1, 1);
            camTruoc01 = new Camera(ConfigurationManager.AppSettings.Get("cam2"), pictureBox2);
            camTruoc01.StartCapture();

            ProtectedPictureBox pictureBox3 = new ProtectedPictureBox();

            pictureBox3.Name     = "cam3";
            pictureBox3.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox3.Dock     = System.Windows.Forms.DockStyle.Fill;
            pictureBox3.Image    = Properties.Resources.camera;
            tableLayoutPanel1.Controls.Add(pictureBox3, 0, 3);
            camSau = new Camera(ConfigurationManager.AppSettings.Get("cam3"), pictureBox3);
            camSau.StartCapture();

            ProtectedPictureBox pictureBox4 = new ProtectedPictureBox();

            pictureBox4.Name     = "cam4";
            pictureBox4.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBox4.Dock     = System.Windows.Forms.DockStyle.Fill;
            pictureBox4.Image    = Properties.Resources.camera;
            tableLayoutPanel1.Controls.Add(pictureBox4, 1, 3);
            camToanCanh = new Camera(ConfigurationManager.AppSettings.Get("cam4"), pictureBox4);
            camToanCanh.StartCapture();
        }
Esempio n. 2
0
        private void frmScalesManager_Load(object sender, EventArgs e)
        {
            hienThiPhieuCan();

            #region Do du lieu vo autocomplete
            //txtKhachHang.AutoCompleteMode = AutoCompleteMode.Suggest;
            //txtKhachHang.AutoCompleteSource = AutoCompleteSource.CustomSource;
            //AutoCompleteStringCollection autoCompleteStringCollection = new AutoCompleteStringCollection();
            //m_KhachHangCtrl.HienThiAutoComplete(autoCompleteStringCollection, txtKhachHang.Text);
            //txtKhachHang.AutoCompleteCustomSource = autoCompleteStringCollection;
            #endregion

            #region hiện thị combobox loại hàng

            //m_loaiHangCtrl.HienThiDataGridViewComboBoxColumn(LoaiHang);
            //m_loaiHangCtrl.HienThiComboBox(cbLoaiHang);
            #endregion
            cauHinhCanTDInfo = cauHinhCanTDCtrl.LayCauHinhCan();
            KLMax            = cauHinhCanTDInfo.KhoiLuong;
            timespan         = cauHinhCanTDInfo.TimeSleep;
            ThongKe();



            // xy ly camera
            ProtectedPictureBox pictureBoxTruoc = new ProtectedPictureBox();
            pictureBoxTruoc.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBoxTruoc.Size     = new System.Drawing.Size(282, 235);
            tableLayoutPanel1.Controls.Add(pictureBoxTruoc, 0, 1);
            camTruoc = new Camera(ConfigurationManager.AppSettings.Get("cam1"), pictureBoxTruoc); // HIKVISION Camera
            camTruoc.StartCapture();

            ProtectedPictureBox pictureBoxSau = new ProtectedPictureBox();
            pictureBoxSau.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBoxSau.Size     = new System.Drawing.Size(282, 235);
            tableLayoutPanel1.Controls.Add(pictureBoxSau, 1, 1);
            camSau = new Camera(ConfigurationManager.AppSettings.Get("cam2"), pictureBoxSau);
            camSau.StartCapture();

            ProtectedPictureBox pictureBoxToanCanh = new ProtectedPictureBox();
            pictureBoxToanCanh.SizeMode = PictureBoxSizeMode.StretchImage;
            pictureBoxToanCanh.Size     = new System.Drawing.Size(282, 235);
            tableLayoutPanel1.Controls.Add(pictureBoxToanCanh, 2, 1);
            camToanCanh = new Camera(ConfigurationManager.AppSettings.Get("cam3"), pictureBoxToanCanh);
            camToanCanh.StartCapture();
        }