コード例 #1
0
        /// <summary>
        /// 点击截屏
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ScreenShot_Click(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.HideCurrentWindow)
            {
                Hide();
                Thread.Sleep(70);
            }

            CaptureImageTool capture = new CaptureImageTool
            {
                SelectCursor = CursorManager.Arrow,
                DrawCursor   = CursorManager.Cross
            };

            if (capture.ShowDialog() == DialogResult.OK)
            {
                Image image = capture.Image;

                if (false == Directory.Exists(ShotPath))
                {
                    //创建pic文件夹
                    Directory.CreateDirectory(ShotPath);
                }
                string filePath = Path.Combine(ShotPath, "BSS-" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ".jpg");
                image.Save(filePath, ImageFormat.Jpeg);
            }

            if (!Visible)
            {
                Show();
            }
        }
コード例 #2
0
        private void vistaButton4_Click(object sender, EventArgs e)
        {
            //所有实现代码在项目CaptureImageTool中
            CaptureImageTool capture = new CaptureImageTool();

            if (checkBoxCursor.Checked)
            {
                capture.SelectCursor = CursorManager.ArrowNew;
                capture.DrawCursor   = CursorManager.CrossNew;
            }
            else
            {
                capture.SelectCursor = CursorManager.Arrow;
                capture.DrawCursor   = CursorManager.Cross;
            }
            if (checkBoxColorTable.Checked)
            {
                capture.ColorTable = _colorTable;
            }

            if (capture.ShowDialog() == DialogResult.OK)
            {
                //显示图片
                if (mdiParent.PicFrom.Image != null)
                {
                    mdiParent.PicFrom.Image.Dispose();
                }
                mdiParent.PicFrom.Image = capture.Image;
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: v5100v5100/ScreenCapturer
        ///
        /// 监视Windows消息
        /// 重载WndProc方法,用于实现热键响应
        ///
        ///
        protected override void WndProc(ref Message m)
        {
            const int WM_HOTKEY = 0x0312;//如果m.Msg的值为0x0312那么表示用户按下了热键

            //按快捷键
            switch (m.Msg)
            {
            case WM_HOTKEY:
                switch (m.WParam.ToInt32())
                {
                case 100:            //按下的是Shift+S
                    //此处填写快捷键响应代码
                    break;

                case 101:            //按下的是Ctrl+B
                    //此处填写快捷键响应代码
                    break;

                case 102:            //按下的是Ctrl+Alt+S
                    CaptureImageTool capture = new CaptureImageTool();

                    if (capture.ShowDialog() == DialogResult.OK)
                    {
                        Image image = capture.Image;
                        //pictureBox1.Width = image.Width;
                        //pictureBox1.Height = image.Height;
                        //pictureBox1.Image = image;
                    }
                    break;
                }
                break;
            }
            base.WndProc(ref m);
        }
コード例 #4
0
        /// <summary>
        /// 监视Windows消息
        /// 重载WndProc方法,用于实现热键响应
        /// </summary>
        /// <param name="m"></param>
        protected override void WndProc(ref Message m)
        {
            const int wmHotkey = 0x0312;//如果m.Msg的值为0x0312那么表示用户按下了热键

            //按快捷键
            switch (m.Msg)
            {
            case wmHotkey:
                switch (m.WParam.ToInt32())
                {
                case 100:            //按下的是Shift+S
                    //此处填写快捷键响应代码
                    break;

                case 101:            //按下的是Ctrl+B
                    //此处填写快捷键响应代码
                    break;

                case 102:            //按下的是Ctrl+Alt+S
                    var capture = new CaptureImageTool();
                    if (capture.ShowDialog() == DialogResult.OK)
                    {
                        Clipboard.SetImage(capture.Image);
                    }
                    break;
                }
                break;
            }
            base.WndProc(ref m);
        }
コード例 #5
0
ファイル: MessagePanel.cs プロジェクト: xingchaoet/ourmsg
        private void tsButCaptureImageTool_Click(object sender, EventArgs e)
        {
            CaptureImageTool capture = new CaptureImageTool();

            if (capture.ShowDialog() == DialogResult.OK)
            {
                Image image = capture.Image;
                if (image != null)
                {
                    System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(myUserID + "\\sendImage");
                    if (!dInfo.Exists)
                    {
                        dInfo.Create();
                    }

                    string fileName = myUserID + "\\sendImage\\temp.gif";
                    image.Save(fileName);
                    string md5         = IMLibrary3.Security.Hasher.GetMD5Hash(fileName);
                    string Md5fileName = myUserID + "\\sendImage\\" + md5 + ".gif";

                    if (!System.IO.File.Exists(Md5fileName))
                    {
                        System.IO.File.Delete(fileName);
                        image.Save(Md5fileName);
                    }
                    this.txtSend.addGifControl(md5, image);
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// 截图
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnScreenShotItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var capture = new CaptureImageTool();

            if (capture.ShowDialog() == DialogResult.OK)
            {
                Clipboard.SetImage(capture.Image);
            }
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: thomashiker/TerminalTool
        private void tSBScreenShot_Click(object sender, EventArgs e)
        {
            CaptureImageTool capture = new CaptureImageTool();

            capture.SelectCursor = Cursors.Default;
            capture.DrawCursor = Cursors.Default;
            if (capture.ShowDialog() == DialogResult.OK)
            {
            }
        }
コード例 #8
0
        /// <summary>
        /// 截图
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barBtnScreenshot_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            CaptureImageTool capture = new CaptureImageTool();

            if (capture.ShowDialog() == DialogResult.OK)
            {
                Image  image = capture.Image;
                byte[] bt    = GetByteImage(image);
            }
        }
コード例 #9
0
        /// <summary>
        /// 截屏
        /// </summary>
        /// <param name="cbx"></param>
        public static void ScreenShot(ChatBox cbx)
        {
            CaptureImageTool capture = new CaptureImageTool();

            if (capture.ShowDialog() == DialogResult.OK)
            {
                Image image = capture.Image;
                cbx.InsertImage(image);
                cbx.Focus();
                cbx.ScrollToCaret();
            }
        }
コード例 #10
0
        private void ScreenShot()
        {
            CaptureImageTool capture = new CaptureImageTool();

            capture.BackColor  = Color.White;
            capture.StyleColor = this.BorderColor;// Color.FromArgb(0, 174, 219);

            capture.SelectCursor = Cursors.Default;
            capture.DrawCursor   = Cursors.Default;
            if (capture.ShowDialog() == DialogResult.OK)
            {
            }
        }
コード例 #11
0
ファイル: MainForm.cs プロジェクト: v5100v5100/ScreenCapturer
        private void btnCapture_Click(object sender, EventArgs e)
        {
            CaptureImageTool capture = new CaptureImageTool();

            //capture.SelectCursor = new Cursor(Properties.Resources.Arrow_M.Handle);
            if (capture.ShowDialog() == DialogResult.OK)
            {
                Image image = capture.Image;
                //pictureBox1.Width = image.Width;
                //pictureBox1.Height = image.Height;
                //pictureBox1.Image = image;
            }
        }
コード例 #12
0
        public void call()
        {
            CaptureImageTool capture = new CaptureImageTool();

            //capture.SelectCursor = new Cursor(Properties.Resources.Arrow_M.Handle);
            if (capture.ShowDialog() == DialogResult.OK)
            {
                Image image = capture.Image;
                pictureBox1.Width  = image.Width;
                pictureBox1.Height = image.Height;
                pictureBox1.Image  = image;
            }
        }
コード例 #13
0
        private void capture_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            System.Threading.Thread.Sleep(30);
            CaptureImageTool capture = new CaptureImageTool();

            capture.SelectCursor = CursorManager.Arrow;
            capture.DrawCursor   = CursorManager.Cross;

            if (capture.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
            {
                this.Show();
            }
        }
コード例 #14
0
        private void InitEvents()
        {
            linkLabelCSharpWin.Click += delegate(object sender, EventArgs e)
            {
                Process.Start("www.csharpwin.com");
            };

            buttonAbout.Click += delegate(object sender, EventArgs e)
            {
                AboutBoxCSharpWinDemo about = new AboutBoxCSharpWinDemo();
                about.ShowDialog();
            };

            buttonCaptureImage.Click += delegate(object sender, EventArgs e)
            {
                if (checkBoxHide.Checked)
                {
                    Hide();
                    System.Threading.Thread.Sleep(30);
                }
                CaptureImageTool capture = new CaptureImageTool();
                if (checkBoxCursor.Checked)
                {
                    capture.SelectCursor = CursorManager.ArrowNew;
                    capture.DrawCursor   = CursorManager.CrossNew;
                }
                else
                {
                    capture.SelectCursor = CursorManager.Arrow;
                    capture.DrawCursor   = CursorManager.Cross;
                }
                if (checkBoxColorTable.Checked)
                {
                    capture.ColorTable = _colorTable;
                }

                if (capture.ShowDialog() == DialogResult.OK)
                {
                    Image image = capture.Image;
                    pictureBox.Width  = image.Width;
                    pictureBox.Height = image.Height;
                    pictureBox.Image  = image;
                }

                if (!Visible)
                {
                    Show();
                }
            };
        }
コード例 #15
0
        private void buttonCaptureImage_Click(object sender, EventArgs e)
        {
            if (checkBoxHide.Checked)
            {
                Hide();
                System.Threading.Thread.Sleep(30);
            }
            var capture = new CaptureImageTool();

            if (checkBoxCursor.Checked)
            {
                capture.SelectCursor = CursorManager.ArrowNew;
                capture.DrawCursor   = CursorManager.CrossNew;
            }
            else
            {
                //var aa = new Cursor("Arrow.cur");
                capture.SelectCursor = CursorManager.Arrow;
                capture.DrawCursor   = CursorManager.Cross;
            }
            if (checkBoxColorTable.Checked)
            {
                capture.ColorTable = _colorTable;
            }

            if (capture.ShowDialog() == DialogResult.OK)
            {
                Image image = capture.Image;
                pictureBox.Width  = image.Width;
                pictureBox.Height = image.Height;
                pictureBox.Image  = image;
                Clipboard.SetDataObject(image);
                if (!Visible)
                {
                    Show();
                    if (WindowState == FormWindowState.Minimized)
                    {
                        WindowState = FormWindowState.Normal;
                    }
                    //WindowState = FormWindowState.Normal;
                    Activate();
                }
            }

            //if (!Visible)
            //{
            //    Show();
            //}
        }
コード例 #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            CaptureImageTool capture = new CaptureImageTool();

            //capture.SelectCursor = new Cursor(Properties.Resources.Arrow_M.Handle);
            if (capture.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("hellow 1");
                Image image = capture.Image;
                MessageBox.Show("hellow 2");
                pictureBox1.Width  = image.Width;
                pictureBox1.Height = image.Height;
                pictureBox1.Image  = image;
            }
        }
コード例 #17
0
 public void StartCaptureImage()
 {
     try
     {
         CaptureImageTool capture = new CaptureImageTool();
         if (capture.ShowDialog() == DialogResult.OK)
         {
             System.Drawing.Image image = capture.Image;
             string file = this.SaveImage(image);
             this.SnippingScreenHandler(file);
         }
         capture.Dispose();
         this.sessionService.IsAllowCut = true;
     }
     catch (System.Exception)
     {
     }
 }
コード例 #18
0
        private void simpleButton6_Click(object sender, EventArgs e)
        {
            if (System.DateTime.Now.ToLongDateString() != TextDetect.Properties.Settings.Default.date_record)
            {
                TextDetect.Properties.Settings.Default.used_cnt = 0;
            }
            if (!licence_helper.enable)
            {
                XtraMessageBox.Show("当日试用次数用完!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //capture.SelectCursor = new Cursor(Properties.Resources.Arrow_M.Handle);
            this.Hide();
            Thread.Sleep(600);
            Application.DoEvents();
            CaptureImageTool capture = new CaptureImageTool();

            if (capture.ShowDialog() == DialogResult.OK)
            {
                if (!Visible)
                {
                    this.BringToFront();
                    this.Show();
                }

                splashScreenManager1.ShowWaitForm();
                Image image = capture.Image;
                pictureEdit2.Image = image;
                richTextBox2.Text  = image_helper.GetText(image);
                splashScreenManager1.CloseWaitForm();
                if (!toggleSwitch2.IsOn)
                {
                    Clipboard.SetText(richTextBox2.Text);
                    XtraMessageBox.Show("文本已经复制到剪切板", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }


            if (!Visible)
            {
                this.BringToFront();
                this.Show();
            }
        }
コード例 #19
0
 /// <summary>
 /// 截图到剪切板
 /// </summary>
 public static void CutImg()
 {
     try
     {
         using (CaptureImageTool capImg = new CaptureImageTool())
         {
             capImg.Closed           += CapImg_Closed;
             GlobalVariable.isCutShow = true;
             if (capImg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 Clipboard.Clear();
                 Clipboard.SetDataObject(capImg.Image);
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteError("[ImageHandle-CutImg]" + ex.Message + ex.Source + ex.StackTrace);
     }
 }
コード例 #20
0
        //void Form1_Load(object sender, EventArgs e)
        //{
        //    capture();
        //}

        void capture()
        {
            CaptureImageTool capture = new CaptureImageTool();

            if (capture.ShowDialog() == DialogResult.OK)
            {
                QRCode.QRCoder qrcoder = new QRCode.QRCoder();

                string stri = qrcoder.ReadQrCode(capture.Image);
                if (!string.IsNullOrEmpty(stri))
                {
                    Clipboard.SetText(stri);
                    textBox1.Text = stri;
                }
                else
                {
                    textBox1.Text    = "未能解析该二维码!";
                    textBox1.Enabled = false;
                }
            }
        }
コード例 #21
0
        private void button2_Click(object sender, EventArgs e)
        {
            CaptureImageTool cit = new CaptureImageTool();

            if (cit.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    BarcodeReader        reader = new BarcodeReader();
                    List <BarcodeFormat> li     = new List <BarcodeFormat>();
                    li.Add(BarcodeFormat.QR_CODE);
                    reader.Options.PossibleFormats = li;
                    Result result = reader.Decode((Bitmap)cit.Image);
                    String errcor = (String)result.ResultMetadata[ResultMetadataType.ERROR_CORRECTION_LEVEL];
                    if (errcor == "L")
                    {
                        comboBox_ErrorCorrect.SelectedIndex = 0;
                    }
                    else if (errcor == "M")
                    {
                        comboBox_ErrorCorrect.SelectedIndex = 1;
                    }
                    else if (errcor == "H")
                    {
                        comboBox_ErrorCorrect.SelectedIndex = 2;
                    }
                    else if (errcor == "Q")
                    {
                        comboBox_ErrorCorrect.SelectedIndex = 3;
                    }
                    String decodedString = result.Text;
                    textBox_selfText.Text = decodedString;
                    refreshSelfText();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("无法识别的二维码!");
                }
            }
        }
コード例 #22
0
        //截图
        public string CaptureImage()
        {
            var r = "";

            try
            {
                CaptureImageTool capture = new CaptureImageTool();
                if (capture.ShowDialog() == DialogResult.OK)
                {
                    var img = capture.Image;
                    Clipboard.SetImage(img);
                    r = "1:截图成功";
                }
                else
                {
                    r = "1:取消截图";
                }
            }
            catch (Exception ex)
            {
                return("0:截图失败:" + ex.Message);
            }
            return(r);
        }
コード例 #23
0
ファイル: MessagePanel.cs プロジェクト: cheehwasun/ourmsg
        private void tsButCaptureImageTool_Click(object sender, EventArgs e)
        {
            CaptureImageTool capture = new CaptureImageTool();
            if (capture.ShowDialog() == DialogResult.OK)
            {
                Image image = capture.Image;
                if (image != null)
                {
                    System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(myUserID+"\\sendImage");
                    if (!dInfo.Exists)
                        dInfo.Create();

                    string fileName =myUserID+"\\sendImage\\temp.gif";
                    image.Save(fileName);
                    string md5 = IMLibrary3.Security.Hasher.GetMD5Hash(fileName);
                    string Md5fileName =myUserID+"\\sendImage\\" + md5 + ".gif";

                    if (!System.IO.File.Exists(Md5fileName))
                    {
                        System.IO.File.Delete(fileName);
                        image.Save(Md5fileName);
                    }
                    this.txtSend.addGifControl(md5, image);
                }
            }
        }
コード例 #24
0
 private void StartCaptureImage()
 {
     CaptureImageTool capture = new CaptureImageTool();
     if (capture.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         System.Drawing.Image image = capture.Image;
         this.SetImageClipboard(image);
         string file = this.SaveCaptureImage(image);
         this.SetImageChatWindow(file);
     }
     this.sessionService.IsAllowCut = true;
 }
コード例 #25
0
 public void StartCaptureImage()
 {
     try
     {
         CaptureImageTool capture = new CaptureImageTool();
         if (capture.ShowDialog() == DialogResult.OK)
         {
             System.Drawing.Image image = capture.Image;
             string file = this.SaveImage(image);
             this.SnippingScreenHandler(file);
         }
         capture.Dispose();
         this.sessionService.IsAllowCut = true;
     }
     catch (System.Exception e)
     {
         this.logger.Error(e.ToString());
     }
 }
コード例 #26
0
ファイル: frmImgProcess.cs プロジェクト: xuanximoming/PIC
        //截图
        private void rb_ScreenShot_Click(object sender, EventArgs e)
        {
            CaptureImageTool capture = new CaptureImageTool();

            capture.ShowDialog();
        }