diff --git a/CameraTest/Capture Display.csproj b/CameraTest/Capture Display.csproj index 7838e81..821f97a 100644 --- a/CameraTest/Capture Display.csproj +++ b/CameraTest/Capture Display.csproj @@ -50,7 +50,7 @@ TRACE prompt 4 - false + true BEAA974CE65F12677E83AFEDE29E3A6F37C226E5 @@ -92,6 +92,27 @@ 7.3 prompt + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + 7.3 + prompt + true + + + bin\x86\Release\ + TRACE + true + pdbonly + AnyCPU + 7.3 + prompt + false + true + ..\packages\Accord.3.8.0\lib\net462\Accord.dll @@ -343,7 +364,6 @@ - diff --git a/CameraTest/MainWindow.Designer.cs b/CameraTest/MainWindow.Designer.cs index 3bd4ad5..789879c 100644 --- a/CameraTest/MainWindow.Designer.cs +++ b/CameraTest/MainWindow.Designer.cs @@ -230,6 +230,8 @@ private void InitializeComponent() // videoSourcePlayer1 // this.videoSourcePlayer1.BackColor = System.Drawing.SystemColors.ActiveBorder; + this.videoSourcePlayer1.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.videoSourcePlayer1.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.videoSourcePlayer1.Location = new System.Drawing.Point(624, 257); this.videoSourcePlayer1.Name = "videoSourcePlayer1"; this.videoSourcePlayer1.Size = new System.Drawing.Size(175, 90); diff --git a/CameraTest/MainWindow.cs b/CameraTest/MainWindow.cs index a5f3a63..8f5f743 100644 --- a/CameraTest/MainWindow.cs +++ b/CameraTest/MainWindow.cs @@ -152,8 +152,6 @@ public void InitalizeCamera() captureDevice.SignalToStop(); captureDevice.WaitForStop(); captureDevice.NewFrame -= CaptureDevice_NewFrame; - pictureBox1.Image = null; - pictureBox2.Image = null; } if(videoSourcePlayer1.VideoSource!=null) { @@ -174,7 +172,7 @@ public void InitalizeCamera() pictureBox1.Visible = true; pictureBox2.Visible = false; } - else + else if(settings.RenderMode == 2) { pictureBox1.Visible = false; pictureBox2.Visible = true; @@ -193,7 +191,7 @@ public void InitalizeCamera() captureDevice.Start(); for (int i = 0; i < captureDevice.VideoCapabilities.Length; i++) { - RenderSizeComboBox.Items.Add(captureDevice.VideoCapabilities[i].FrameSize.Width.ToString() + " x " + captureDevice.VideoCapabilities[i].FrameSize.Height.ToString() + " @" + captureDevice.VideoCapabilities[i].MaximumFrameRate); + RenderSizeComboBox.Items.Add(captureDevice.VideoCapabilities[i].FrameSize.Width.ToString() + " x " + captureDevice.VideoCapabilities[i].FrameSize.Height.ToString() + " @" + captureDevice.VideoCapabilities[i].AverageFrameRate); } if (RenderSizeComboBox.Items.Count > 0) { @@ -205,7 +203,6 @@ public void InitalizeCamera() { RenderSizeComboBox.SelectedIndex = 0; } - UpdateDisplayMode(); } } } @@ -229,9 +226,10 @@ private void CaptureDevice_NewFrame(object sender, NewFrameEventArgs eventArgs) { if (settings.RenderMode == 1) { - pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone(); + Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone(); + pictureBox1.Image = bitmap; } - else + else if(settings.RenderMode == 2) { pictureBox2.Image = (Bitmap)eventArgs.Frame.Clone(); } @@ -326,20 +324,20 @@ private void Wave_DataAvailable(object sender, WaveInEventArgs e) #region Display/Scale Options private void RenderSizeComboBox_SelectedIndexChanged(object sender, EventArgs e) { - if (captureDevice != null) + if (RenderSizeComboBox.SelectedIndex != -1) { - var tempFPS = FPSCount; - FPSCount = false; - captureDevice.SignalToStop(); - captureDevice.WaitForStop(); - if (RenderSizeComboBox.SelectedIndex != -1) + if (captureDevice != null) { + var tempFPS = FPSCount; + FPSCount = false; + captureDevice.SignalToStop(); + captureDevice.WaitForStop(); captureDevice.VideoResolution = captureDevice.VideoCapabilities[RenderSizeComboBox.SelectedIndex]; + UpdateDisplayMode(); + captureDevice.Start(); + FPSCount = tempFPS; + SetSettings(); } - UpdateDisplayMode(); - captureDevice.Start(); - FPSCount = tempFPS; - SetSettings(); } } @@ -477,12 +475,17 @@ void SizeObjectsScale() videoSourcePlayer1.Location = new Point((ClientSize.Width - videoSourcePlayer1.ClientSize.Width) / 2, (ClientSize.Height - videoSourcePlayer1.ClientSize.Height) / 2); } change = true; + AutoSize = false; pictureBox1.Location = videoSourcePlayer1.Location; pictureBox1.Size = videoSourcePlayer1.Size; pictureBox1.Dock = videoSourcePlayer1.Dock; pictureBox2.Location = videoSourcePlayer1.Location; pictureBox2.Size = videoSourcePlayer1.Size; pictureBox2.Dock = videoSourcePlayer1.Dock; + if (DisplaySizeComboBox.SelectedIndex == 0) + { + AutoSize = true; + } change = false; } @@ -496,7 +499,7 @@ private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e) { if(RenderModeComboBox.SelectedIndex!=-1) { - settings.RenderMode = RenderModeComboBox.SelectedIndex; + settings.RenderMode = RenderModeComboBox.SelectedIndex; SetSettings(); InitalizeCamera(); } @@ -572,5 +575,6 @@ private void MainWindow_MouseEnter(object sender, EventArgs e) UpdateDisplayMode(); } } + } } \ No newline at end of file diff --git a/Capture Display.sln b/Capture Display.sln index 789a532..c5ce2be 100644 --- a/Capture Display.sln +++ b/Capture Display.sln @@ -9,18 +9,24 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {396464B0-BAD1-424F-8326-4DB1348D2A19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {396464B0-BAD1-424F-8326-4DB1348D2A19}.Debug|Any CPU.Build.0 = Debug|Any CPU {396464B0-BAD1-424F-8326-4DB1348D2A19}.Debug|x64.ActiveCfg = Debug|x64 {396464B0-BAD1-424F-8326-4DB1348D2A19}.Debug|x64.Build.0 = Debug|x64 + {396464B0-BAD1-424F-8326-4DB1348D2A19}.Debug|x86.ActiveCfg = Debug|x86 + {396464B0-BAD1-424F-8326-4DB1348D2A19}.Debug|x86.Build.0 = Debug|x86 {396464B0-BAD1-424F-8326-4DB1348D2A19}.Release|Any CPU.ActiveCfg = Release|Any CPU {396464B0-BAD1-424F-8326-4DB1348D2A19}.Release|Any CPU.Build.0 = Release|Any CPU {396464B0-BAD1-424F-8326-4DB1348D2A19}.Release|x64.ActiveCfg = Release|x64 {396464B0-BAD1-424F-8326-4DB1348D2A19}.Release|x64.Build.0 = Release|x64 + {396464B0-BAD1-424F-8326-4DB1348D2A19}.Release|x86.ActiveCfg = Release|x86 + {396464B0-BAD1-424F-8326-4DB1348D2A19}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE