/// <summary> /// Captures the screen. /// </summary> private void captureScreen() { Point p = Control.MousePosition; p.X -= bmpScreenCapture.Width / 2; p.Y -= bmpScreenCapture.Height / 2; using (System.Drawing.Graphics dc = System.Drawing.Graphics.FromImage(bmpScreenCapture)) { dc.CopyFromScreen(p, new Point(0, 0), bmpScreenCapture.Size); Color c = bmpScreenCapture.GetPixel( (int)(bmpScreenCapture.Size.Width / 2.0F), (int)(bmpScreenCapture.Size.Height / 2.0F)); if (c != _SelectedColor) { _SelectedColor = c; if (SelectedColorChanged != null) { SelectedColorChanged(this, null); } } if (_ShowPixelPreview || _ShowColorPreview) { if (pixelZoom == null) { pixelZoom = new PixelZoom(this); } pixelZoom.PaintScreenCapture(bmpScreenCapture); } OnScreenCaptured(); } }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.MouseUp" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs" /> that contains the event data.</param> protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); { Cursor = Cursors.Arrow; iscapturing = false; if (pixelZoom != null) { pixelZoom.Close(); pixelZoom.Dispose(); pixelZoom = null; } this.Invalidate(); this.OnEndScreenCapture(); } }
private void captureScreen() { Point p = Control.MousePosition; p.X -= bmpScreenCapture.Width / 2; p.Y -= bmpScreenCapture.Height / 2; using (System.Drawing.Graphics dc = System.Drawing.Graphics.FromImage(bmpScreenCapture)) { dc.CopyFromScreen(p, new Point(0, 0), bmpScreenCapture.Size); Color c = bmpScreenCapture.GetPixel( (int)(bmpScreenCapture.Size.Width / 2.0F), (int)(bmpScreenCapture.Size.Height / 2.0F)); if (c != _SelectedColor) { _SelectedColor = c; if (SelectedColorChanged != null) SelectedColorChanged(this, null); } if (_ShowPixelPreview || _ShowColorPreview) { if (pixelZoom == null) pixelZoom = new PixelZoom(this); pixelZoom.PaintScreenCapture(bmpScreenCapture); } OnScreenCaptured(); } }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); { Cursor = Cursors.Hand; iscapturing = false; if (pixelZoom != null) { pixelZoom.Close(); pixelZoom.Dispose(); pixelZoom = null; } this.Invalidate(); this.OnEndScreenCapture(); } }