private void Configure_croparea_MouseDown(object sender, MouseEventArgs e) { _isCapture = true; _cropRectOffset = e.Location; Configure_croparea.Invalidate(); }
private void Configure_croparea_MouseUp(object sender, MouseEventArgs e) { if (_isCapture == false) { return; } _isCapture = false; if (_cropRect.Width < 1) { _cropRect.Width = 1; } if (_cropRect.Height < 1) { _cropRect.Height = 1; } if (_cropRect.X + _cropRect.Width > Configure_croparea.Width) { _cropRect.Width = Configure_croparea.Width - _cropRect.X; } if (_cropRect.Y + _cropRect.Height > Configure_croparea.Height) { _cropRect.Height = Configure_croparea.Height - _cropRect.Y; } Configure_UpDown_CropX.Value = _cropRect.X; Configure_UpDown_CropY.Value = _cropRect.Y; Configure_UpDown_CropWidth.Value = _cropRect.Width; Configure_UpDown_CropHeight.Value = _cropRect.Height; Configure_croparea.Invalidate(); }
public void Init(Setting camera = null) { MainForm form = (MainForm)this.Owner; Setting cam; if (camera == null) { cam = form.camera; } else { cam = camera; } double downRatio = ((double)Configure_croparea.Width / (double)form.panel1.Width); Configure_textbox_camID.Text = Convert.ToString(cam.camID, 10); Configure_textbox_rtspurl.Text = cam.camURL; Configure_textbox_savepath.Text = cam.savePath; _cropRect = new Rectangle((int)(cam.cropX * downRatio), (int)(cam.cropY * downRatio), (int)(cam.cropWidth * downRatio), (int)(cam.cropHeight * downRatio)); Configure_croparea.Invalidate(); Configure_UpDown_CropX.Value = _cropRect.X; Configure_UpDown_CropY.Value = _cropRect.Y; Configure_UpDown_CropWidth.Value = _cropRect.Width; Configure_UpDown_CropHeight.Value = _cropRect.Height; Configure_textbox_timeout.Text = Convert.ToString(cam.timeout, 10); Configure_textbox_countForPass.Text = Convert.ToString(cam.countForPass, 10); Configure_checkBox_isResize.Checked = cam.isResize; Configure_textbox_size.Text = Convert.ToString(cam.size, 10); }
private void Configure_croparea_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Point p = e.Location; int x = Math.Min(_cropRectOffset.X, p.X); int y = Math.Min(_cropRectOffset.Y, p.Y); int w = Math.Abs(p.X - _cropRectOffset.X); int h = Math.Abs(p.Y - _cropRectOffset.Y); _cropRect = new Rectangle(x, y, w, h); Configure_croparea.Invalidate(); } }
public void Init() { MainForm form = (MainForm)this.Owner; double downRatio = ((double)Configure_croparea.Width / (double)form.panel1.Width); Configure_textbox_camID.Text = Convert.ToString(form.camera.camID, 10); Configure_textbox_rtspurl.Text = form.camera.camURL; _cropRect = new Rectangle((int)(form.cropX * downRatio), (int)(form.cropY * downRatio), (int)(form.cropWidth * downRatio), (int)(form.cropHeight * downRatio)); Configure_croparea.Invalidate(); Configure_UpDown_CropX.Value = _cropRect.X; Configure_UpDown_CropY.Value = _cropRect.Y; Configure_UpDown_CropWidth.Value = _cropRect.Width; Configure_UpDown_CropHeight.Value = _cropRect.Height; }
private void Configure_UpDown_CropHeight_ValueChanged(object sender, EventArgs e) { _cropRect.Height = (int)Configure_UpDown_CropHeight.Value; Configure_croparea.Invalidate(); }
private void Configure_UpDown_CropWidth_ValueChanged(object sender, EventArgs e) { _cropRect.Width = (int)Configure_UpDown_CropWidth.Value; Configure_croparea.Invalidate(); }