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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| Private Sub DessinRadar()
radar2.Location = New Point(0, 60) ' radar2 est la picturebox
radar2.Size = New Size(352, 342)
radar2.BackColor = Color.CadetBlue
radar2.BorderStyle = BorderStyle.FixedSingle
Controls.Add(radar2) 'jout de la picturebox au FORM
ecran = Graphics.FromImage(fond) ' fond est le bitmap
ecran.SmoothingMode = SmoothingMode.HighQuality
Dim C1 As New RectangleF(25, 0, 300, 300) ' écran radar cercle 1
ecran.DrawEllipse(New Pen(Color.Black), C1)
Dim c2 As New RectangleF(75, 50, 200, 200) ' ecran radar cercle 2
ecran.DrawEllipse(New Pen(Color.Black), c2)
Dim c3 As New RectangleF(125, 100, 100, 100) ' ecran radar cercle 3
ecran.DrawEllipse(New Pen(Color.Black), c3)
ecran.DrawLine(New Pen(Color.Black), 175, 0, 175, 300) 'ligne verticale ecran radar
ecran.DrawLine(New Pen(Color.Black), 25, 150, 325, 150) ' ligne horizontale ecranradar
Dim pointA As New Point(45, 85)
Dim pointB As New Point(35, 110)
Dim pointC As New Point(55, 110)
Dim cible1 As Point() = {pointA, pointB, pointC} 'cible en forme de triangle
SB = New SolidBrush(Color.Blue)
ecran.FillPolygon(SB, cible1)
'cible2 = New RectangleF(50, 90, 25, 25)
Dim pointS As New Point(200, 200 - 12)
Dim pointBG As New Point(200 - 6, 200 + 6)
Dim pointHG As New Point(200 - 6, 200 - 6)
Dim pointHD As New Point(200 + 6, 200 - 6)
Dim pointBD As New Point(200 + 6, 200 + 6)
cible2 = {pointBG, pointHG, pointS, pointHD, pointBD} ' cible en forme de maison
Mypen.Color = Color.Black
Mypen.Width = 1
SB.Color = Color.Black
ecran.DrawPolygon(Mypen, cible2)
ecran.FillPolygon(SB, cible2)
SB = New SolidBrush(Color.Green)
radar2.Image = fond
Dim Xcible As Integer = 100
Dim Ycible As Integer = 100
Dim pointT As New Point(Xcible, Ycible - 12)
Dim pointBL As New Point(Xcible - 6, Ycible + 6)
Dim pointTL As New Point(Xcible - 6, Ycible - 6)
Dim pointTR As New Point(Xcible + 6, Ycible - 6)
Dim pointBR As New Point(Xcible + 6, Ycible + 6)
Dim Cible3 As Point() = {pointBL, pointTL, pointT, pointTR, pointBR} ' cible en forme de maison
Mypen.Color = Color.Black
Mypen.Width = 1
SB.Color = Color.Black
ecran.DrawPolygon(Mypen, Cible3)
ecran.FillPolygon(SB, Cible3)
radar2.Image = fond
Dim cadreCible As Rectangle = New Rectangle(Xcible - 12, Ycible - 14, 24, 24) 'c'est le cadre qui entoure la cible sélectionnée
Mypen.Color = Color.White
Mypen.Width = 1
ecran.DrawRectangle(Mypen, cadreCible)
radar2.Image = fond
AddHandler radar2.Click, AddressOf TargetSeltest
AddHandler radar2.DoubleClick, AddressOf TargetDoubleClicktest
End Sub
Private Sub Bt_Efface_Click(sender As Object, e As EventArgs) Handles Bt_EffCadre.Click
cadreCible.Width = 0
cadreCible.Height = 0
cadreCible.Location = New Point(0, 0)
cadreCible.Inflate(0, 0)
ecran.DrawRectangle(Mypen, cadreCible)
cadreCible = Rectangle.Empty
radar2.Invalidate(cadreCible)
radar2.Update()
radar2.Invalidate(cible3)
cible2 = Nothing
'radar2.Image = fond
radar2.Refresh()
End Sub |