0

I'm trying to place red crosses when the user double click on the screen. So I have a picture box that extract X and Y position when we double click on it. (with a GetX() & GetY()) function.

I'm trying to dynamically create a picture box and fill it with my "cross.png" file. Here's what I've tried so far :

Dim pb As New PictureBox
        pb.Width = 100 'or whatever
        pb.Height = 200
        pb.Top = 50 'or whatever
        pb.Left = 50
        pb.ImageLocation = "C:\Users\Over_\Desktop\proto_mini_project_-_face_recognition (1)\proto mini project - face recognition\proto mini project - face recognition\cross.png"
        Me.Controls.Add(pb)

I've found this solutions on StackOverflow but I don't really understand how to use it, or maybe I'm missing something. Alose I execute this part of the code in :

    Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles faceImage.DoubleClick

If anyone got an idea/solution I would gladly take it. Kind regards, Mehdi.

evry1falls
  • 194
  • 4
  • 15
  • Can you give some more information please, like what exactly isn't working. Any errors? – Slugsie May 29 '20 at 13:18
  • Yes, so I don’t get any specific error message this is just that I don’t have any image that are displayed. I’ve tried with a button but still it doesn’t looks like something is happening even when I press the button multiple times – OverNeos May 30 '20 at 13:04

1 Answers1

0

I've found the solution to my problem. The new picture box wasn't in foreground, so i've added the following line : pb.BringToFront()