예제 #1
0
        void HookManager_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (FirstClick)
                {
                    FirstClick        = false;
                    ShotZone          = new Rectangle();
                    ShotZone.Location = e.Location;
                }
                else
                {
                    ShotZone.Width  = e.X - ShotZone.X;
                    ShotZone.Height = e.Y - ShotZone.Y;

                    HookManager.MouseClick -= new MouseEventHandler(HookManager_MouseClick);

                    Bitmap screenshot = ScreenShot.SpecificScreenShot(ShotZone);
                    string filepath   = Path.Combine(GetSavePath(), GetFileName());
                    screenshot.Save(filepath, ImageFormat.Png);

                    //MessageBox.Show("Rect => X: " + ShotZone.X + ", Y: " + ShotZone.Y + ", Width: " + ShotZone.Width + ", Height: " + ShotZone.Height);
                }
            }
        }
예제 #2
0
        void hk3_HotkeyPressed(object sender, System.EventArgs e)
        {
            switch (nbpress)
            {
            case 0:
                //affiche tooltip

                if (OnTooltipWanted != null)
                {
                    CoreEventArgs args = new CoreEventArgs();
                    args.Message = "Souris en TopLeft puis F9";
                    OnTooltipWanted(this, args);
                }
                nbpress++;
                break;

            case 1:
                ShotZone          = new Rectangle();
                ShotZone.Location = Cursor.Position;
                nbpress++;

                if (OnTooltipWanted != null)
                {
                    CoreEventArgs args = new CoreEventArgs();
                    args.Message = "Souris en BottomRight puis F9";
                    OnTooltipWanted(this, args);
                }
                break;

            case 2:
                ShotZone.Width  = Cursor.Position.X - ShotZone.X;
                ShotZone.Height = Cursor.Position.Y - ShotZone.Y;

                Bitmap screenshot = ScreenShot.SpecificScreenShot(ShotZone);
                if (screenshot != null)
                {
                    string filepath = Path.Combine(GetSavePath(), GetFileName());
                    screenshot.Save(filepath, ImageFormat.Png);
                    SendShotEvent(filepath);
                }
                else
                {
                    SendShotFailedEvent();
                }
                nbpress = 0;
                break;
            }
            // Screen Zone
            //FirstClick = true;
            //HookManager.MouseClick += new MouseEventHandler(HookManager_MouseClick);
        }