You can simplify your code significantly. Instead of creating a tempRect when mouse is down, you can create tempStartPoint This way, you will not need that many manipulations in the MouseMove event handler, all the code will boil down to one statement: tempRect = new Rectangle( Math. Min(tempStartPoint.
X, tempEndPoint. X), Math. Min(tempStartPoint.
Y, tempEndPoint. Y), Math. Abs(tempStartPoint.
X - tempEndPoint. X), Math. Abs(tempStartPoint.
Y - tempEndPoint. Y)) Full code: public partial class Form1 : Form { private readonly List rects = new List(); private Point tempStartPoint; private Rectangle tempRect; public Form1() { InitializeComponent(); } private void Form1_MouseDown(object sender, MouseEventArgs e) { tempStartPoint = e. Location; Invalidate(); } private void Form1_MouseMove(object sender, MouseEventArgs e) { if (e.
Button! = MouseButtons. Left) return; Point tempEndPoint = e.
Location; tempRect = new Rectangle( Math. Min(tempStartPoint. X, tempEndPoint.
X), Math. Min(tempStartPoint. Y, tempEndPoint.
Y), Math. Abs(tempStartPoint. X - tempEndPoint.
X), Math. Abs(tempStartPoint. Y - tempEndPoint.
Y)); Invalidate(); } private void Form1_MouseUp(object sender, MouseEventArgs e) { // Must be within constraint, prevents tiny invisible rectangles from being added if (tempRect. Width >= 10 && tempRect. Height >= 10) rects.
Add(tempRect); } private void Form1_Paint(object sender, PaintEventArgs e) { using (Pen pen = new Pen(Color. Black, 2)) { // Redraws all existing rectangles onto the form foreach (Rectangle rect in rects) e.Graphics. DrawRectangle(pen, rect); // Must be within constraint, prevents tiny invisible rectangles from being added if (tempRect.
Width >= 10 && tempRect. Height >= 10) e.Graphics. DrawRectangle(pen, tempRect); } } }.
You can simplify your code significantly. Instead of creating a tempRect when mouse is down, you can create tempStartPoint. This way, you will not need that many manipulations in the MouseMove event handler, all the code will boil down to one statement: tempRect = new Rectangle( Math.
Min(tempStartPoint. X, tempEndPoint. X), Math.
Min(tempStartPoint. Y, tempEndPoint. Y), Math.
Abs(tempStartPoint. X - tempEndPoint. X), Math.
Abs(tempStartPoint. Y - tempEndPoint. Y)); Full code: public partial class Form1 : Form { private readonly List rects = new List(); private Point tempStartPoint; private Rectangle tempRect; public Form1() { InitializeComponent(); } private void Form1_MouseDown(object sender, MouseEventArgs e) { tempStartPoint = e.
Location; Invalidate(); } private void Form1_MouseMove(object sender, MouseEventArgs e) { if (e. Button! = MouseButtons.
Left) return; Point tempEndPoint = e. Location; tempRect = new Rectangle( Math. Min(tempStartPoint.
X, tempEndPoint. X), Math. Min(tempStartPoint.
Y, tempEndPoint. Y), Math. Abs(tempStartPoint.
X - tempEndPoint. X), Math. Abs(tempStartPoint.
Y - tempEndPoint. Y)); Invalidate(); } private void Form1_MouseUp(object sender, MouseEventArgs e) { // Must be within constraint, prevents tiny invisible rectangles from being added if (tempRect. Width >= 10 && tempRect.
Height >= 10) rects. Add(tempRect); } private void Form1_Paint(object sender, PaintEventArgs e) { using (Pen pen = new Pen(Color. Black, 2)) { // Redraws all existing rectangles onto the form foreach (Rectangle rect in rects) e.Graphics.
DrawRectangle(pen, rect); // Must be within constraint, prevents tiny invisible rectangles from being added if (tempRect. Width >= 10 && tempRect. Height >= 10) e.Graphics.
DrawRectangle(pen, tempRect); } } }.
Much easier to read too, not sure where my bug was but this breaking it down like this makes it much easier to maintain and all works like a charm :) – Mohgeroth Jun 21 at 2:47.
You can simplify your code significantly. Instead of creating a tempRect when mouse is down, you can create tempStartPoint . This way, you will not need that many manipulations in the MouseMove event handler, all the code will boil down to one statement.
Index #: 0Source: . Net SqlClient Data ProviderClass: 17Number: 1105Procedure: AddEventLogMessage: System.Data.SqlClient. SqlException: Could not allocate space for object 'dbo.
EventLog'.'PK_EventLogMaster' in database 'joh0733606453581' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.