protected override void WndProc(ref Message m)
 {
     if (m.Msg == Constants.WM_HOTKEY_MSG_ID)
     {
         if (!CheckSettings())
         {
             MessageBox.Show("Settings incomplete, please check them.");
             return;
         }
         // Full screenshot
         if ((int)m.WParam == 0)
         {
             Grabber.EncodeAndUpload(null);
         }
         // Partial screenshot
         else if ((int)m.WParam == 1)
         {
             Grabber.CaptureAndCrop();
         }
     }
     base.WndProc(ref m);
 }
예제 #2
0
        private void panelCutting_MouseUp(object sender, MouseEventArgs e)
        {
            dragging = false;

            int width  = curPos.X - dragStart.X;
            int height = curPos.Y - dragStart.Y;

            if (width <= 0 || height <= 0 || dragStart.X + width > bitmap.Width || dragStart.Y + height > bitmap.Height)
            {
                return;
            }

            Rectangle cutRect   = new Rectangle(dragStart.X, dragStart.Y, width, height);
            Bitmap    cutBitmap = bitmap.Clone(cutRect, bitmap.PixelFormat);

            dragStart = Point.Empty;
            curPos    = Point.Empty;
            panelCutting.Invalidate();

            Hide();
            Grabber.EncodeAndUpload(cutBitmap);
            Cleanup();
            Close();
        }