// 保存批注 private void btnSaveComment_Click(object sender, EventArgs e) { BLog.ToDB("保存批注"); if (commentImageList1.Count < config.MaxCommentImageCount) { string imgPath = string.Format(config.CommentSavePath + @"\{0}\{1}.PNG", DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMddHHmmssfff")); if (!Directory.Exists(config.CommentSavePath + "\\" + DateTime.Now.ToString("yyyyMMdd"))) Directory.CreateDirectory(config.CommentSavePath + "\\" + DateTime.Now.ToString("yyyyMMdd")); if (img == null)//img有等于null的时候? { ImageFromControl(ref gpHide); } img.Save(imgPath, System.Drawing.Imaging.ImageFormat.Png); commentImageList1.AddPic(imgPath); NoticeShow("批注已保存"); List<Bitmap> temp1 = new List<Bitmap>(); foreach (Bitmap img2 in Progress) temp1.Add(img2); Stack<Bitmap> temp2 = new Stack<Bitmap>(); foreach (Bitmap img2 in Backup) temp2.Push(img2); lmgList.Add(temp1); lmgStack.Add(temp2); } else { MessageBox.Show(string.Format("浏览历史列表只能保存{0}个批注,请清空后再保存", config.MaxCommentImageCount)); } }
// 退出程序 private void btnExitApp_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("是否要退出?", "退出提示", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { BLog.ToDB("退出程序"); Application.Exit(); } }
// 截图 private void btnSnapshot_Click(object sender, EventArgs e)//考虑优化去掉 { BLog.ToDB("拍照"); if (commentImageList1.Count < config.MaxCommentImageCount) { string imgPath = string.Format(config.PictureSavePath + @"\{0}\{1}.PNG", DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMddHHmmssfff")); if (!Directory.Exists(config.PictureSavePath + "\\" + DateTime.Now.ToString("yyyyMMdd"))) Directory.CreateDirectory(config.PictureSavePath + "\\" + DateTime.Now.ToString("yyyyMMdd")); ImageFromControl(ref gpHide); img.Save(imgPath, System.Drawing.Imaging.ImageFormat.Png); commentImageList1.AddPic(imgPath); List<Bitmap> temp1 = new List<Bitmap>(); foreach (Bitmap img2 in Progress) temp1.Add(img2); Stack<Bitmap> temp2 = new Stack<Bitmap>(); foreach (Bitmap img2 in Backup) temp2.Push(img2); lmgList.Add(temp1); lmgStack.Add(temp2); //ImageFromControl(ref gpHide); ImageFromControl(ref gpEra, ref imgEra); Progress.Add(new Bitmap(imgEra)); } else { MessageBox.Show(string.Format("浏览历史列表只能保存{0}个批注,请清空后再保存", config.MaxCommentImageCount)); } /* string picPath = string.Format(config.PictureSavePath + @"\{0}\{1}.bmp", DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("yyyyMMddHHmmssfff")); if (!Directory.Exists(config.PictureSavePath + "\\" + DateTime.Now.ToString("yyyyMMdd"))) Directory.CreateDirectory(config.PictureSavePath + "\\" + DateTime.Now.ToString("yyyyMMdd")); Booth.fnCatchPic(picPath); NoticeShow("截图已保存"); BLog.ToDB("拍照:" + picPath); if (!string.IsNullOrEmpty(picPath)) { resource = new Resource(); try { resource.Apptype = AppType.实物展台; resource.File = new FileInfo(picPath); AppInterface.CreateNewResource(resource); } catch { } } */ }
// 打开错题集目录 private void btnOpenErr_Click(object sender, EventArgs e) { BLog.ToDB("打开错题集"); if (cbSubject.SelectedIndex == 0) { System.Diagnostics.Process.Start(config.ErrColSavePath); } else { System.Diagnostics.Process.Start(config.ErrColSavePath + "\\" + cbSubject.Items[cbSubject.SelectedIndex].ToString()); } }
// 录像 void RecordStart() { BLog.ToDB("开始录像"); string timespan = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"); string packName = config.VideoSavePath + "\\" + timespan; fileName = packName + "\\video.mp4"; if (!Directory.Exists(packName)) Directory.CreateDirectory(packName); rtspRecorderId = m_csAVFrm.createMp4Recorder(fileName); m_csAVFrm.addPreviewerToRecorder(rtspRecorderId, audioPreviewerId); m_csAVFrm.addPreviewerToRecorder(rtspRecorderId, videoPreviewerId); m_csAVFrm.startRecordMp4(rtspRecorderId); }
// 结束批注 private void btnExitComment_Click(object sender, EventArgs e) { BLog.ToDB("结束批注"); isDraw = false; btnForward.Visible = false; btnBackward.Visible = false; btnSaveComment.Visible = false; btnExitComment.Visible = false; EnableRecord(); btnZoom.Enabled = true; //btnSubject.Enabled = false; //btnJoinErrCol.Enabled = false; StopComment(null, null); Progress.Clear(); Backup.Clear(); btnForward.Enabled = false; btnBackward.Enabled = false; img = null; imgEra = null; NoticeShow("已经结束批注"); }
// 变倍 + private void btnNear_Click(object sender, EventArgs e) { Booth.fnZoomIn(zoomStep); NoticeShow("进行放大"); BLog.ToDB("放大画面"); }
// 变倍 - private void btnFar_Click(object sender, EventArgs e) { Booth.fnZoomOut(zoomStep); NoticeShow("进行缩小"); BLog.ToDB("缩小画面"); }
private void btnCommentPath_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start(config.CommentSavePath); BLog.ToDB("打开批注目录"); }
// 加入错题集:如果是批注状态,批注的图片入错题集,否则原始图片入错题集 private void btnJoinErrCol_Click(object sender, EventArgs e) { if (cbSubject.SelectedIndex == 0) { MessageBox.Show("请选择科目."); return; } if (!isDraw) { gpEra = plCamera.CreateGraphics(); gpEra.SmoothingMode = SmoothingMode.AntiAlias; gpEra.InterpolationMode = InterpolationMode.HighQualityBicubic; gpEra.CompositingQuality = CompositingQuality.HighQuality; ImageFromControl(ref gpEra, ref imgEra); Progress.Add(new Bitmap(imgEra)); } if (commentImageList1.Count < config.MaxCommentImageCount) { BLog.ToDB("加入错题集"); btnJoinErrCol.Enabled = false; string dirName = config.ErrColSavePath + "\\" + cbSubject.Items[cbSubject.SelectedIndex].ToString() + "\\" + DateTime.Now.ToString("yyyyMMdd"); if (!Directory.Exists(dirName)) Directory.CreateDirectory(dirName); string imgPath = dirName + "\\" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".PNG"; if (img == null) { ImageFromControl(ref gpHide); } if (isPen) { img.Save(imgPath, System.Drawing.Imaging.ImageFormat.Png); } else { Graphics g = plCamera.CreateGraphics(); ImageFromControl(ref g); img.Save(imgPath, System.Drawing.Imaging.ImageFormat.Png); } commentImageList1.AddPic(imgPath); List<Bitmap> temp1 = new List<Bitmap>(); foreach (Bitmap img2 in Progress) temp1.Add(img2); Stack<Bitmap> temp2 = new Stack<Bitmap>(); foreach (Bitmap img2 in Backup) temp2.Push(img2); lmgList.Add(temp1); lmgStack.Add(temp2); NoticeShow("已加入错题集"); Thread.Sleep(1000); btnJoinErrCol.Enabled = true; img = null; } else { MessageBox.Show(string.Format("浏览历史列表只能保存{0}个批注,请清空后再保存", config.MaxCommentImageCount)); } }
// 停止 void RecordStop() { m_csAVFrm.stopRecordMp4(rtspRecorderId); BLog.ToDB("停止录像"); }