示例#1
0
        /// <summary>
        /// 截图
        /// </summary>
        public void capture(Panel panel)
        {
            if (m_mainForm.CapturePath.Length == 0)
            {
                MessageBox.Show("未设置截图路径");
                return;
            }
            try
            {
                foreach (OneDialog dlg in m_dialogs)
                {
                    if (dlg.panel == panel)
                    {
                        string path = m_mainForm.CapturePath + "\\"
                                      + dlg.timeStamp.Year + dlg.timeStamp.Month.ToString().PadLeft(2, '0')
                                      + dlg.timeStamp.Day.ToString().PadLeft(2, '0') + dlg.timeStamp.Hour.ToString().PadLeft(2, '0')
                                      + dlg.timeStamp.Minute.ToString().PadLeft(2, '0') + dlg.timeStamp.Second.ToString().PadLeft(2, '0')
                                      + dlg.timeStamp.Millisecond.ToString().PadLeft(3, '0') + ".jpg";


                        //截图
                        int ret = BVCU.ManagedLayer_CuSnapshot(m_bvsdkHandle, dlg.dialogHandle, Encoding.UTF8.GetBytes(path), 85);

                        BVCU.FAILED(ret);
                        break;
                    }
                }
            }
            catch
            {
                MessageBox.Show("截图失败");
            }
        }