Welcome to FoxLearn
In this tutorial, I'll show you how to create a custom PictureBox that allows you to move it in the form with the mouse
To create a custom PictureBox, you should create a new class, then make it inherit from the PictureBox control
You need to override the OnMouseDown and OnMouseMove event handlers that allow you to move a PictureBox with your mouse in a form
First, you need to get the current position in the OnMouseDown event handler when you click the mouse
Next, you need to change the PictureBox position when moving the mouse in the OnMouseMove event handler
After you finish creating a custom PictureBox control, you need to rebuild your project
You will see custom controls automatically added to the Visual Studio Toolbox
We will drag two custom PictureBox controls from the Visual Studio Toolbox into the form designer, then add images to the custom PictureBox
Thank you for watching this video and don't forget to subscribe to my channel