//Timer para mostrar el panel 3 segundos private void TimerPanel_Tick(object sender, EventArgs e) { int Num = Convert.ToInt32(lblSeg.Text); lblSeg.Text = Convert.ToString(Num - 1); if (lblSeg.Text == "0") { TimerPanel.Stop(); panel1.Visible = false; TimerPanel.Enabled = false; TimerVideo.Enabled = true; TimerVideo.Start(); } }
//cattura schermo(img)---------------------------------------------- //cattura schermo(video)---------------------------------------------- private void btVideo_Click(object sender, EventArgs e) { PathFolderVideo = "Video"; if (btVideo.ButtonText == "Inizia cattura video") { btVideo.ActiveFillColor = Color.Red; btVideo.ActiveLineColor = Color.Red; btVideo.IdleForecolor = Color.Red; btVideo.IdleLineColor = Color.Red; btVideo.ButtonText = "Termina cattura video"; var fileName = Path.Combine(PathFolderVideo, $"Video_{DateTime.Now.ToString("yyyyMMddHHmmss")}"); nome = fileName; writer = new VideoFileWriter(); writer.Open(fileName + ".avi", 640, 480, 25, VideoCodec.MPEG4); TimerVideo.Start(); } else { pictureBox2.Visible = false; btAnteprima.Visible = false; btVideo.ActiveFillColor = Color.SeaGreen; btVideo.ActiveLineColor = Color.SeaGreen; btVideo.IdleForecolor = Color.SeaGreen; btVideo.IdleLineColor = Color.SeaGreen; btVideo.ButtonText = "Inizia cattura video"; TimerVideo.Stop(); MessageBox.Show($"video salvato in:\n{nome}", "salva", MessageBoxButtons.OK, MessageBoxIcon.Information); writer.Close(); axWindowsMediaPlayer1.Visible = true; axWindowsMediaPlayer1.URL = "" + $"{ nome}.avi"; } }