示例#1
0
        public string CaptureView()
        {
            string day  = DateTime.Now.ToString("yyyyMMdd");       //取系统时间
            string time = DateTime.Now.ToString("yyyyMMddHHmmss"); //取系统时间
            string path = day + "\\c-" + time + ".jpg";

            if (a == 1)
            {
                if (HkAction.CapturePicture(path))//调用SDK截图方法
                {
                    //MessageBox.Show("截图成功,保存在:" + path, "提示", MessageBoxButtons.OK);
                }
                else
                {
                    path = "";
                    MessageBox.Show("截图失败", "提示", MessageBoxButtons.OK);
                }
            }
            else
            {
                MessageBox.Show("请先点击“开始”按钮!", "提示", MessageBoxButtons.OK);
                path = "";
            }
            return(path);
        }
示例#2
0
        private void btnCapt_Click(object sender, EventArgs e)
        {
            HkAction.MainForm.Hide();
            string time = DateTime.Now.ToString("yyyyMMddHHmmss"); //取系统时间

            if (a == 1)
            {
                string path1 = ShowSaveFileDialog(time);//获取用户选择路径
                if (path1 == null)
                {
                    MessageBox.Show("截图取消", "提示", MessageBoxButtons.OK);
                    return;
                }

                string path = path1 + "-" + time + ".jpg";//保存路径和文件名(用户选择路径)
                //string path = @"C:\Users\Administrator\Downloads\"+time + ".jpg";//指定路径

                if (HkAction.CapturePicture(path))//调用SDK截图方法
                {
                    MessageBox.Show("截图成功,保存在:" + path, "提示", MessageBoxButtons.OK);
                }
                else
                {
                    MessageBox.Show("截图失败", "提示", MessageBoxButtons.OK);
                }
            }
            else
            {
                MessageBox.Show("请先点击“开始”按钮!", "提示", MessageBoxButtons.OK);
            }

            HkAction.MainForm.Show();
        }