Private Sub PictureBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick If e.Button = Windows.Forms.MouseButtons.Left Then PictureBox1.Tag = "draw" Refresh() End If If e.Button = Windows.Forms.MouseButtons.Right Then PictureBox1.Tag = "not draw" Refresh() End If End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint If PictureBox1.Tag = "draw" Then drawX(e.Graphics) End If End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load PictureBox1.Tag = "not draw" End Sub
Public Class Form1 Dim flagshow As Boolean Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load flagshow = False End Sub Private Sub PictureBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick If e.Button = Windows.Forms.MouseButtons.Left Then flagshow = True PictureBox1.Invalidate() End If If e.Button = Windows.Forms.MouseButtons.Right Then flagshow = False PictureBox1.Invalidate() End If End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint If flagshow Then drawX(e.Graphics) End If End Sub Private Sub drawCercle(ByVal GR As System.Drawing.Graphics) Dim mypen As New Pen(Color.Red, 2) GR.DrawArc(mypen, 0, 0, PictureBox1.Width - 2, PictureBox1.Height - 2, 0, 360) End Sub
Private Sub drawX(ByVal GR As System.Drawing.Graphics) Dim mypen As New Pen(Color.Red, 2) GR.DrawArc(mypen, 0, 0, PictureBox1.Width - 2, PictureBox1.Height - 2, 0, 360) End Sub
Public Class Form1 Private mousecoordinates As New List(Of Point) Private radius As Integer Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load radius = 40 End Sub Private Sub DrawCercles(ByVal GR As System.Drawing.Graphics) Dim mypen As New Pen(Color.Red, 2) For Each element In mousecoordinates GR.DrawArc(mypen, element.X - radius, element.Y - radius, 2 * radius, 2 * radius, 0, 360) Next End Sub Private Sub PictureBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick If e.Button = Windows.Forms.MouseButtons.Left Then mousecoordinates.Add(New Point(e.X, e.Y)) PictureBox1.Invalidate() End If End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint DrawCercles(e.Graphics) End Sub End Class
GR.DrawArc(mypen, 0, 0, 20, 20, 0, 360)
Sub CoordonéeSouris etc..Handle Mouse.Clic (ou un truc du genre) Dim XClic as single Dim YClic as single MousePositionX = XClic MousePositionY = YClic
GR.DrawArc(mypen, MousePosition.X, MousePosition.Y, 20, 20, 0, 360)
Public Class SchemaFuite Dim flagshow As Boolean Private Sub SchemaFuite_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load flagshow = False MsgBox("un clic sur le bouton droit pour marquer la fuite" & vbCr & "un clic sur le bouton gauche pour effacer", 48, "Veuillez cliquer l'endroit où les fuites ont été détectées") If TA0501.PSE True And TA0501.RBT_Cabine1.Enabled True Then 'TODO: arriver a afficher les images d'après les ressource 'affiche le chemin pour le schéma de la clim cabine Sud-Est ElseIf TA0501.PSE True And TA0501.RBT_FroidDomestique.Enabled True Then '" le schéma du froid domestique sud-est ElseIf TA0501.PSE True And TA0501.RBT_Remoque.Enabled True Then '" le schéma de la clim remorque ElseIf TA0501.DUP True And TA0501.RBT_Cabine1.Enabled True Then '" le schéma de la clim cabine duplex/Res ElseIf TA0501.DUP True And TA0501.RBT_FroidDomestique.Enabled True Then '" le schéma du froid domestique duplex ElseIf TA0501.PLT True And TA0501.RBT_Cabine1.Enabled True Then '" le schéma de la clim cabine duplex/Res ElseIf TA0501.PLT True And TA0501.RBT_FroidDomestique.Enabled True Then '" le schéma du froid domestique ElseIf TA0501.PLT True And TA0501.RBT_Remoque.Enabled True Then '"le schéma de la clim remorque End If PictureBox1.Load() End Sub Private Sub PictureBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseClick If e.Button = Windows.Forms.MouseButtons.Left Then flagshow = True PictureBox1.Invalidate() End If If e.Button = Windows.Forms.MouseButtons.Right Then flagshow = False PictureBox1.Invalidate() End If End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint If flagshow Then drawX(e.Graphics) End If End Sub Private Sub drawX(ByVal GR As System.Drawing.Graphics) Dim mypen As New Pen(Color.Red, 2) GR.DrawArc(mypen, MousePosition.X, MousePosition.Y, 20, 20, 0, 360) End Sub End Class