Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public structure Area
- int pX;
- int pY;
- int sX;
- int sY;
- bool xForward;
- bool yForward;
- end structure
- private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
- {
- if (MousePressed == true)
- {
- int TempLX = 0, TempRX = 0, TempLY = 0, TempRY = 0, Area Selection;
- if (e.X > Selection.pX)
- {
- if (Selection.xForward == true)
- {
- Selection.sX = e.X;
- }
- else
- {
- if (e.X < Selection.sX)
- {
- Selection.pX = e.X;
- }
- else
- {
- Selection.pX = Selection.sX;
- Selection.sX = e.X;
- Selection.xForward = true;
- }
- }
- }
- else
- {
- if (Selection.xForward == true)
- {
- Selection.sX = Selection.pX;
- Selection.pX = e.X;
- Selection.xForward = false;
- }
- else
- {
- if (Selection.pX <= Selection.sX)
- {
- Selection.pX = e.X;
- }
- else
- {
- Selection.sX = e.X;
- }
- }
- }
- if (e.Y > Selection.pY)
- {
- if (Selection.yForward == true)
- {
- Selection.sY = e.Y;
- }
- else
- {
- if (e.Y < Selection.sY)
- {
- Selection.pY = e.Y;
- }
- else
- {
- Selection.pY = Selection.sY;
- Selection.sY = e.Y;
- Selection.yForward = true;
- }
- }
- }
- else
- {
- if (Selection.yForward == true)
- {
- Selection.sY = Selection.pY;
- Selection.pY = e.Y;
- Selection.yForward = false;
- }
- else
- {
- if (Selection.pY <= Selection.sY)
- {
- Selection.pY = e.Y;
- }
- else
- {
- Selection.sY = e.Y;
- }
- }
- }
- pictureBox2.Size = new Size(Selection.sX, Selection.sY);
- pictureBox2.Location = new Point(Selection.pX, Selection.pY);
- }
- }
Add Comment
Please, Sign In to add comment