0

The point I need help is that when I try to do a click event, a different point of a picture box object should be positioned, not the top left corner.

Is there a way to change the reference moving point of an object?

Example:

The point shown as "Yellow Circle" is the reference point where the "pictureBoxRed" object is located in any mouse click event.

The point shown as "Black Star" is a point indicating the position to be clicked for example.

If the sample point shown as "Black Star" is clicked with the left cursor, it must be moved from the "Yellow Circle" point of the "pictureBoxRed" object, not the upper left corner point of the "pictureBoxRed" object.

Thanks for your aid.

Here Example Gif Animation About This Problem

    private void Exmp(object sender, MouseEventArgs e)
    {
        GeneralClick(e.Button, e.X, e.Y);
    }

    PictureBox picRed = new PictureBox();
    PictureBox picBlue = new PictureBox();

    private void GeneralClick(MouseButtons sender, int X, int Y)
    {
        if (sender == MouseButtons.Left)
        {
            picRed.Location = new Point(X, Y);
            var arrayer = this.PointToScreen(picRed.Location);
            arrayer = picBlue.PointToClient(arrayer);
            picRed.Parent = picBlue;
        }
    }
        public Form1()
    {
        InitializeComponent();
        picBlue.MouseClick+= new MouseEventHandler(Exmp);
    }
drakislow
  • 41
  • 2
  • 9

0 Answers0