Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click PictureBox1.ImageLocation = "C:\...\...jpg" End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint If CheckBox1.Checked Then e.Graphics.DrawRectangle(Pens.Red, 0, 0, 20, 20) End If If CheckBox2.Checked Then e.Graphics.DrawRectangle(Pens.Green, 40, 0, 20, 20) End If If CheckBox3.Checked Then e.Graphics.DrawRectangle(Pens.Blue, 80, 0, 20, 20) End If End Sub Private Sub CheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged, CheckBox2.CheckedChanged, CheckBox3.CheckedChanged PictureBox1.Invalidate() End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.PictureBox1.CreateGraphics.Clear(Color.White) Me.PictureBox1.Image = System.Drawing.Image.FromFile(Application.StartupPath & "" & "PC030001-2.jpg") Me.PictureBox1.CreateGraphics.DrawRectangle(Shape.Couleur, Shape.Localisation) End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint Me.PictureBox1.CreateGraphics.DrawRectangle(Shape.Couleur, Shape.Localisation) End Sub
Private Sub DrawShapes(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint lblTest.Text = CInt(lblTest.Text) + 1 Dim camera As ISDisplay_Host For Each camera In Me.Cameras Dim Shape As ShapeDisplay For Each Shape In camera.Shapes If Shape.Visible Then e.Graphics.DrawRectangle(Shape.Couleur, Shape.Localisation) End If Next Next End Sub