private void PBox_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && mode == cropMenuItem) { Rectangle crop = GetRectangleFromPoints( ZoomPicBoxCoordsToImageCoords(pMouseDown, pBox), ZoomPicBoxCoordsToImageCoords(pMouseCurrently, pBox)); if (crop.Width == 0 || crop.Height == 0) { isMouseDown = false; return; } images.Insert(imagesIndex + 1, new Screenshot(ScreenshotHelper.CropImage(images[imagesIndex].Image, crop), images[imagesIndex].FileName + "_CROPPED")); imagesIndex += 1; UpdateUI(); } isMouseDown = false; }
private void PictureBox1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Rectangle crop = GetRectangleFromPoints( new Point((int)(pMouseDown.X * (double)fullScreenshot.Width / pBox.Width), (int)(pMouseDown.Y * (double)fullScreenshot.Height / pBox.Height)), new Point((int)(pMouseCurrently.X * (double)fullScreenshot.Width / pBox.Width), (int)(pMouseCurrently.Y * (double)fullScreenshot.Height / pBox.Height))); if (crop.Width == 0 || crop.Height == 0) { MessageBox.Show("Thats a little too small, dont you think?", "Too Smol", MessageBoxButtons.OK); IsLeftMouseDown = false; return; } output = ScreenshotHelper.CropImage(fullScreenshot, crop); IsLeftMouseDown = false; this.Close(); } else if (e.Button == MouseButtons.Middle) { gifArea = GetRectangleFromPoints( new Point((int)((pMouseDown.X + ScreenshotHelper.allScreenBounds.X) * (double)fullScreenshot.Width / pBox.Width), (int)((pMouseDown.Y + ScreenshotHelper.allScreenBounds.Y) * (double)fullScreenshot.Height / pBox.Height)), new Point((int)((pMouseCurrently.X + ScreenshotHelper.allScreenBounds.X) * (double)fullScreenshot.Width / pBox.Width), (int)((pMouseCurrently.Y + ScreenshotHelper.allScreenBounds.Y) * (double)fullScreenshot.Height / pBox.Height))); if (gifArea.Width == 0 || gifArea.Height == 0) { MessageBox.Show("Thats a little too small, dont you think?", "Too Smol", MessageBoxButtons.OK); IsMiddleMouseDown = false; return; } IsMiddleMouseDown = false; Debug.WriteLine("Set gif area to: " + gifArea); this.Close(); } else if (e.Button == MouseButtons.Right) { this.Close(); } }
private void PBox_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { ContextMenu m = new ContextMenu(); //m.MenuItems.Add(new MenuItem("Fix Width Ratio", ((object s, EventArgs ev) => //{ // try // { // UpdateWindowRatioWidth(); // } // catch { } //}))); //m.MenuItems.Add(new MenuItem("Fix Height Ratio", ((object s, EventArgs ev) => //{ // try // { // UpdateWindowRatioHeight(); // } // catch { } //}))); GraphicsUnit Unit = GraphicsUnit.Pixel; if (images[imagesIndex].Image.GetBounds(ref Unit).Width == ScreenshotHelper.allScreenBounds.Width) { int i = 1; foreach (Screen S in Screen.AllScreens) { m.MenuItems.Add(new MenuItem("Crop to " + i.ToShitEnglishNumberThingy() + " Screen", ((object s, EventArgs ev) => { try { images.Insert(imagesIndex + 1, new Screenshot(ScreenshotHelper.CropImage(images[imagesIndex].Image, new Rectangle(S.Bounds.X - ScreenshotHelper.allScreenBounds.X, S.Bounds.Y - ScreenshotHelper.allScreenBounds.Y, S.Bounds.Width, S.Bounds.Height)), images[imagesIndex].FileName + "_CROPPED")); imagesIndex++; UpdateUI(); } catch { } }))); i++; } } m.MenuItems.Add(new MenuItem("1:1 Size", ((object s, EventArgs ev) => { try { SetOriginalSize(); } catch { } }))); m.MenuItems.Add(new MenuItem("Smol Size", ((object s, EventArgs ev) => { try { Height = 350; Width = 350; CenterAroundMouse(); } catch { } }))); m.Show(pBox, e.Location); } }