Guest User

Untitled

a guest
Jul 18th, 2018
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 6.63 KB | None | 0 0
  1. Public Structure Area
  2.     Public minX As Integer
  3.     Public minY As Integer
  4.     Public maxX As Integer
  5.     Public maxY As Integer
  6.     Public xForward As Boolean
  7.     Public yForward As Boolean
  8.     Public Lock As Boolean
  9. End Structure
  10.  
  11. Dim Selection As Area
  12.  
  13. Private Sub PictureBox6_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox6.MouseMove
  14.         If Selection.Lock = True Then
  15.             With Selection
  16.                 If e.Location.X < 0 Then
  17.                     .minX = 0
  18.                 ElseIf e.Location.Y < 0 Then
  19.                     .minY = 0
  20.                 ElseIf PictureBox6.Width < e.Location.X Then
  21.                     .maxX = PictureBox6.Width - 1
  22.                     If PictureBox6.Height > e.Location.Y Then
  23.                         If e.Location.Y > .minY Then
  24.                             If .yForward = True Then
  25.                                 .maxY = e.Location.Y
  26.                             Else
  27.                                 If e.Location.Y < .maxY Then
  28.                                     .minY = e.Location.Y
  29.                                 Else
  30.                                     .minY = .maxY
  31.                                     .maxY = e.Location.Y
  32.                                     .yForward = True
  33.                                 End If
  34.                             End If
  35.                         Else
  36.                             If .yForward = True Then
  37.                                 .maxY = .minY
  38.                                 .minY = e.Location.Y
  39.                                 .yForward = False
  40.                             Else
  41.                                 If .minY <= .maxY Then
  42.                                     .minY = e.Location.Y
  43.                                 Else
  44.                                     .maxY = e.Location.Y
  45.                                 End If
  46.                             End If
  47.                         End If
  48.                     End If
  49.                 ElseIf PictureBox6.Height < e.Location.Y Then
  50.                     .maxY = PictureBox6.Height - 1
  51.                     If PictureBox6.Width > e.Location.X Then
  52.                         If e.Location.X > .minX Then
  53.                             If .xForward = True Then
  54.                                 .maxX = e.Location.X
  55.                             Else
  56.                                 If e.Location.X < .maxX Then
  57.                                     .minX = e.Location.X
  58.                                 Else
  59.                                     .minX = .maxX
  60.                                     .maxX = e.Location.X
  61.                                     .xForward = True
  62.                                 End If
  63.                             End If
  64.                         Else
  65.                             If .xForward = True Then
  66.                                 .maxX = .minX
  67.                                 .minX = e.Location.X
  68.                                 .xForward = False
  69.                             Else
  70.                                 If .minX <= .maxX Then
  71.                                     .minX = e.Location.X
  72.                                 Else
  73.                                     .maxX = e.Location.X
  74.                                 End If
  75.                             End If
  76.                         End If
  77.                     End If
  78.                 Else
  79.                     If e.Location.X > .minX Then
  80.                         If .xForward = True Then
  81.                             .maxX = e.Location.X
  82.                         Else
  83.                             If e.Location.X < .maxX Then
  84.                                 .minX = e.Location.X
  85.                             Else
  86.                                 .minX = .maxX
  87.                                 .maxX = e.Location.X
  88.                                 .xForward = True
  89.                             End If
  90.                         End If
  91.                     Else
  92.                         If .xForward = True Then
  93.                             .maxX = .minX
  94.                             .minX = e.Location.X
  95.                             .xForward = False
  96.                         Else
  97.                             If .minX <= .maxX Then
  98.                                 .minX = e.Location.X
  99.                             Else
  100.                                 .maxX = e.Location.X
  101.                             End If
  102.                         End If
  103.                     End If
  104.                     If e.Location.Y > .minY Then
  105.                         If .yForward = True Then
  106.                             .maxY = e.Location.Y
  107.                         Else
  108.                             If e.Location.Y < .maxY Then
  109.                                 .minY = e.Location.Y
  110.                             Else
  111.                                 .minY = .maxY
  112.                                 .maxY = e.Location.Y
  113.                                 .yForward = True
  114.                             End If
  115.                         End If
  116.                     Else
  117.                         If .yForward = True Then
  118.                             .maxY = .minY
  119.                             .minY = e.Location.Y
  120.                             .yForward = False
  121.                         Else
  122.                             If .minY <= .maxY Then
  123.                                 .minY = e.Location.Y
  124.                             Else
  125.                                 .maxY = e.Location.Y
  126.                             End If
  127.                         End If
  128.                     End If
  129.                 End If
  130.                 TextBox22.Text = Round(6000 / TrackBar14.Value * .minX - 3000, 6)
  131.                 TextBox23.Text = Round(6000 / TrackBar14.Value * .minY - 3000, 6)
  132.                 If .maxX = PictureBox6.Width - 1 Then
  133.                     TextBox24.Text = 3000
  134.                 Else
  135.                     TextBox24.Text = Round(6000 / TrackBar14.Value * .maxX - 3000, 6)
  136.                 End If
  137.                 If .maxY = PictureBox6.Height - 1 Then
  138.                     TextBox25.Text = 3000
  139.                 Else
  140.                     TextBox25.Text = Round(6000 / TrackBar14.Value * .maxY - 3000, 6)
  141.                 End If
  142.                 TextBox22.Text = TextBox22.Text.Replace(",", ".")
  143.                 TextBox23.Text = TextBox23.Text.Replace(",", ".")
  144.                 TextBox24.Text = TextBox24.Text.Replace(",", ".")
  145.                 TextBox25.Text = TextBox25.Text.Replace(",", ".")
  146.                 PictureBox6.Refresh()
  147.                 PictureBox6.CreateGraphics.DrawRectangle(New Pen(Settings.C_Area.Hex), New Rectangle(.minX, .minY, .maxX - .minX, .maxY - .minY))
  148.                 PictureBox6.CreateGraphics.Dispose()
  149.             End With
  150.         End If
  151.     End Sub
Add Comment
Please, Sign In to add comment