private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { if (!start) { if (e.Button == MouseButtons.Left) { p0 = e.Location; } SplashScreen.Refresh(); start = true; } else { if (SplashScreen.Image == null) { return; } if (e.Button == MouseButtons.Left) { SplashScreen.Refresh(); p1 = e.Location; SplashScreen.CreateGraphics().DrawRectangle(selectPen, RectByTwoPoints(p0, e.Location)); } start = false; PrepareBitmap(); this.Close(); } }
private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { if (SplashScreen.Image == null) { return; } if (start) { SplashScreen.Refresh(); SplashScreen.CreateGraphics().DrawRectangle(selectPen, RectByTwoPoints(p0, e.Location)); } }
private void SplashScreen_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && start == true && p0 != e.Location && SplashScreen.Image != null) { SplashScreen.Refresh(); p1 = e.Location; SplashScreen.CreateGraphics().DrawRectangle(selectPen, RectByTwoPoints(p0, e.Location)); start = false; PrepareBitmap(); this.Close(); } }