1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Private Sub pnlCarte_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pnlCarte.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
g_obj_bufferSelection = BufferedGraphicsManager.Current.Allocate(pnlCarte.CreateGraphics, pnlCarte.DisplayRectangle)
g_obj_bufferSelection.Graphics.Clear(Color.White)
Dim ux As Integer
Dim lx As Integer
Dim uy As Integer
Dim ly As Integer
If g_obj_locationPoint.X > e.X Then
ux = g_obj_locationPoint.X
lx = e.X
Else
ux = e.X
lx = g_obj_locationPoint.X
End If
If g_obj_locationPoint.Y > e.Y Then
uy = g_obj_locationPoint.Y
ly = e.Y
Else
uy = e.Y
ly = g_obj_locationPoint.Y
End If
Dim l_obj_rectangle As New Rectangle(lx, ly, ux - lx, uy - ly)
g_obj_bufferSelection.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(120, 173, 216, 230)), l_obj_rectangle)
g_obj_bufferSelection.Graphics.DrawRectangle(Pens.Navy, l_obj_rectangle)
g_obj_bufferSelection.Render()
g_obj_bufferSelection.Dispose()
End If
End Sub |
Partager