public void RotatePictureBox() { if (m_CurrentCamera != null) { CamResolution camResolution = m_CurrentCamera.CurrentResolution; if (camResolution != null && camResolution.Width > 0 && camResolution.Height > 0) { if (camResolution.Width / camResolution.Height > iControlWidth / iControlHeight) { int iVideoHeight = iControlHeight; int iVideoWidth = iControlHeight * camResolution.Height / camResolution.Width; int iContentWidth = panel1.Width - panel1.Margin.Left - panel1.Margin.Right - panel1.Padding.Left - panel1.Padding.Right; pictureBox1.Location = new Point((iContentWidth - iVideoWidth) / 2, 0); pictureBox1.Size = new Size(iVideoWidth, iVideoHeight); } else { int iVideoWidth = iControlWidth; int iVideoHeight = iControlWidth * camResolution.Width / camResolution.Height; int iContentHeight = panel1.Height - panel1.Margin.Top - panel1.Margin.Bottom - panel1.Padding.Top - panel1.Padding.Bottom; pictureBox1.Location = new Point(0, (iContentHeight - iVideoHeight) / 2); pictureBox1.Size = new Size(iVideoWidth, iVideoHeight); } } } }
public void ResizePictureBox() { if (m_CurrentCamera != null) { CamResolution camResolution = m_CurrentCamera.CurrentResolution; if (camResolution != null && camResolution.Width > 0 && camResolution.Height > 0) { { int iVideoWidth = iControlWidth; int iVideoHeight = iControlWidth * camResolution.Height / camResolution.Width; int iContentHeight = panel1.Height - panel1.Margin.Top - panel1.Margin.Bottom - panel1.Padding.Top - panel1.Padding.Bottom; if (iVideoHeight < iContentHeight) { pictureBox1.Location = new Point(0, (iContentHeight - iVideoHeight) / 2); pictureBox1.Size = new Size(iVideoWidth, iVideoHeight); } else { pictureBox1.Location = new Point(0, 0); pictureBox1.Size = new Size(pictureBox1.Width, pictureBox1.Height); } } } } }
private void RotatePictureBox() { if (m_Camera != null) { CamResolution camResolution = m_Camera.CurrentResolution; if (camResolution != null && camResolution.Width > 0 && camResolution.Height > 0) { if (camResolution.Width / camResolution.Height > border1.Width / border1.Height) { double iVideoHeight = border1.Height; double iVideoWidth = border1.Height * camResolution.Height / camResolution.Width; image1.Margin = new Thickness((border1.Width - iVideoWidth) / 2, 0, 0, 0); image1.Width = iVideoWidth; image1.Height = iVideoHeight; } else { double iVideoWidth = border1.Width; double iVideoHeight = border1.Width * camResolution.Width / camResolution.Height; image1.Margin = new Thickness(0, (border1.Height - iVideoHeight) / 2, 0, 0); image1.Width = iVideoWidth; image1.Height = iVideoHeight; } } } }
private void ResizeVideoWindow() { if (m_Camera != null) { CamResolution tempCamResolution = m_Camera.CurrentResolution; if (tempCamResolution != null) { double iVideoWidth = border1.Width; double iVideoHeight = border1.Width * tempCamResolution.Height / tempCamResolution.Width; m_Camera.ResizeVideoWindow((int)(border1.Margin.Left + border1.BorderThickness.Left), (int)(border1.Margin.Top + (border1.ActualHeight - iVideoHeight) / 2), (int)(iVideoWidth - border1.BorderThickness.Left - border1.BorderThickness.Right), (int)iVideoHeight); } } }
private void ResizeVideoWindow() { CamResolution camResolution = m_CurrentCamera.CurrentResolution; if (camResolution != null && camResolution.Width > 0 && camResolution.Height > 0) { { int iVideoWidth = pictureBox1.Width; int iVideoHeight = pictureBox1.Width * camResolution.Height / camResolution.Width; int iContentHeight = panel1.Height - panel1.Margin.Top - panel1.Margin.Bottom - panel1.Padding.Top - panel1.Padding.Bottom; if (iVideoHeight < iContentHeight) { m_CurrentCamera.ResizeVideoWindow(0, (iContentHeight - iVideoHeight) / 2, iVideoWidth, iVideoHeight); } else { m_CurrentCamera.ResizeVideoWindow(0, 0, pictureBox1.Width, pictureBox1.Height); } } } }