Beispiel #1
0
        private static Bitmap GetScreen(bool bCaptureCursor, bool bFromClipBoard)
        {
            Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);

            if (bCaptureCursor)
            {
                FormPrintScreen.DrawCurToScreen();
            }
            using (Graphics graphics = Graphics.FromImage((Image)bitmap))
            {
                graphics.SmoothingMode = SmoothingMode.HighQuality;
                graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
                if (!bFromClipBoard)
                {
                    return(bitmap);
                }
                using (Image image = Clipboard.GetImage())
                {
                    if (image != null)
                    {
                        using (SolidBrush solidBrush = new SolidBrush(Color.FromArgb(150, 0, 0, 0)))
                        {
                            graphics.FillRectangle((Brush)solidBrush, 0, 0, bitmap.Width, bitmap.Height);
                            graphics.DrawImage(image, bitmap.Width - image.Width >> 1, bitmap.Height - image.Height >> 1, image.Width, image.Height);
                        }
                    }
                }
            }
            return(bitmap);
        }
Beispiel #2
0
        private void FrmCapture_Load(object sender, EventArgs e)
        {
            this.InitMember();
            this.imageProcessBox1.BaseImage = (Image)FormPrintScreen.GetScreen(this.isCaptureCursor, this.isFromClipBoard);
            this.m_MHook.SetHook();
            this.m_MHook.MHookEvent += new MouseHook.MHookEventHandler(this.m_MHook_MHookEvent);
            this.imageProcessBox1.IsDrawOperationDot = false;
            //this.BeginInvoke((Delegate) (() => this.Enabled = false));
            ControlHandler handler = delegate()
            {
                base.Enabled = false;
            };

            base.BeginInvoke(handler);
            this.timer1.Interval = 500;
            this.timer1.Enabled  = true;
        }