Inheritance: System.Windows.Forms.Form
示例#1
0
        private void VideoDevicePreview_Click(object sender, EventArgs e)
        {
            if (VideoDeviceMenu.SelectedIndex < 0)
            {
                MessageBox.Show("Please select a capture device first", "HCS Config");
                return;
            }
            HCS_Encoder.VideoCapture cam = null;
            try {
                cam = new HCS_Encoder.VideoCapture(VideoDeviceMenu.SelectedIndex,
                                                   (int)FrameRate.Value, (int)CaptureWidth.Value, (int)CaptureHeight.Value);

                FrameRate.Value     = cam.m_frameRate;
                CaptureHeight.Value = cam.Height;
                CaptureWidth.Value  = cam.Width;

                // preview with scaling:
                cam.TargetFrameSize = new Size((int)OutputWidth.Value, (int)OutputHeight.Value);

                VideoPreview prev = new VideoPreview(cam);
                prev.ShowDialog();
            } catch {
                MessageBox.Show("Those settings don't work.\r\n(capture device refused to initialise, please check your device's documentation)", "HCS Config");
                if (cam != null)
                {
                    cam.Dispose();
                }
            }
        }
示例#2
0
        private void VideoDevicePreview_Click(object sender, EventArgs e)
        {
            if (VideoDeviceMenu.SelectedIndex < 0) {
                MessageBox.Show("Please select a capture device first", "HCS Config");
                return;
            }
            HCS_Encoder.VideoCapture cam = null;
            try {
                cam = new HCS_Encoder.VideoCapture(VideoDeviceMenu.SelectedIndex,
                    (int)FrameRate.Value, (int)CaptureWidth.Value, (int)CaptureHeight.Value);

                FrameRate.Value = cam.m_frameRate;
                CaptureHeight.Value = cam.Height;
                CaptureWidth.Value = cam.Width;

                // preview with scaling:
                cam.TargetFrameSize = new Size((int)OutputWidth.Value, (int)OutputHeight.Value);

                VideoPreview prev = new VideoPreview(cam);
                prev.ShowDialog();
            } catch {
                MessageBox.Show("Those settings don't work.\r\n(capture device refused to initialise, please check your device's documentation)", "HCS Config");
                if (cam != null) cam.Dispose();
            }
        }