Guest User

Untitled

a guest
Jul 18th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.00 KB | None | 0 0
  1. public structure Area
  2.     int pX;
  3.     int pY;
  4.     int sX;
  5.     int sY;
  6.     bool xForward;
  7.     bool yForward;
  8. end structure
  9.  
  10. private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
  11. {
  12.     if (MousePressed == true)
  13.     {
  14.         int TempLX = 0, TempRX = 0, TempLY = 0, TempRY = 0, Area Selection;
  15.         if (e.X > Selection.pX)
  16.         {
  17.             if (Selection.xForward == true)
  18.             {
  19.                 Selection.sX = e.X;
  20.             }
  21.             else
  22.             {
  23.                 if (e.X < Selection.sX)
  24.                 {
  25.                     Selection.pX = e.X;
  26.                 }
  27.                 else
  28.                 {
  29.                     Selection.pX = Selection.sX;
  30.                     Selection.sX = e.X;
  31.                     Selection.xForward = true;
  32.                 }
  33.             }
  34.         }
  35.         else
  36.         {
  37.             if (Selection.xForward == true)
  38.             {
  39.                 Selection.sX = Selection.pX;
  40.                 Selection.pX = e.X;
  41.                 Selection.xForward = false;
  42.             }
  43.             else
  44.             {
  45.                 if (Selection.pX <= Selection.sX)
  46.                 {
  47.                     Selection.pX = e.X;
  48.                 }
  49.                 else
  50.                 {
  51.                     Selection.sX = e.X;
  52.                 }
  53.             }
  54.         }
  55.         if (e.Y > Selection.pY)
  56.         {
  57.             if (Selection.yForward == true)
  58.             {
  59.                 Selection.sY = e.Y;
  60.             }
  61.             else
  62.             {
  63.                 if (e.Y < Selection.sY)
  64.                 {
  65.                     Selection.pY = e.Y;
  66.                 }
  67.                 else
  68.                 {
  69.                     Selection.pY = Selection.sY;
  70.                     Selection.sY = e.Y;
  71.                     Selection.yForward = true;
  72.                 }
  73.             }
  74.         }
  75.         else
  76.         {
  77.             if (Selection.yForward == true)
  78.             {
  79.                 Selection.sY = Selection.pY;
  80.                 Selection.pY = e.Y;
  81.                 Selection.yForward = false;
  82.             }
  83.             else
  84.             {
  85.                 if (Selection.pY <= Selection.sY)
  86.                 {
  87.                     Selection.pY = e.Y;
  88.                 }
  89.                 else
  90.                 {
  91.                     Selection.sY = e.Y;
  92.                 }
  93.             }
  94.         }
  95.         pictureBox2.Size = new Size(Selection.sX, Selection.sY);
  96.         pictureBox2.Location = new Point(Selection.pX, Selection.pY);
  97.     }
  98. }
Add Comment
Please, Sign In to add comment