Esempio n. 1
0
        private void Window_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (this.isMouseDown)
            {
                double curx = e.GetPosition(null).X;
                double cury = e.GetPosition(null).Y;

                System.Windows.Shapes.Rectangle r = new System.Windows.Shapes.Rectangle();
                SolidColorBrush brush             = new SolidColorBrush(Colors.White);
                r.Stroke          = brush;
                r.Fill            = brush;
                r.StrokeThickness = 1;
                r.Width           = Math.Abs(curx - x);
                r.Height          = Math.Abs(cury - y);
                cnv.Children.Clear();
                cnv.Children.Add(r);
                Canvas.SetLeft(r, Math.Min(x, curx));
                Canvas.SetTop(r, Math.Min(y, cury));
                if (e.LeftButton == MouseButtonState.Released)
                {
                    cnv.Children.Clear();
                    width            = Math.Abs(curx - x);
                    height           = Math.Abs(cury - y);
                    bitmap           = ScreenShotMaker.CaptureScreen(width, height, Math.Min(x, curx) - 7, Math.Min(y, cury) - 7);
                    this.x           = this.y = 0;
                    this.isMouseDown = false;
                    this.Close();
                }
            }
        }
Esempio n. 2
0
        private void activieWindowSceen()
        {
            System.Drawing.Rectangle resolution = new System.Drawing.Rectangle();
            IntPtr tempPtr = GetForegroundWindow();

            GetWindowRect(tempPtr, ref resolution);

            if (resolution.Width != 0 && resolution.Height != 00)
            {
                System.Drawing.Bitmap image = ScreenShotMaker.CaptureScreen(resolution.Width - resolution.X,
                                                                            resolution.Height - resolution.Y,
                                                                            resolution.X, resolution.Y);
                saveImage(image);
            }
        }