'Make a transparent and movable pictureBox in windows forms app

I used this tutorial to create a transparent picture box: https://www.codeproject.com/Articles/25048/How-to-Use-Transparent-Images-and-Labels-in-Window

However the issue is when I move the Object it also moves the background, so for example if it starts as this: Original position

The transparent object is the image in the top left.

Then if I move the image it looks like this:

Second position of transparent image

It seems to drag the background with it.

The one thing I have figured out so far is that if the image is moved to the edge of the form then the background resets.

I assume this is because the OnPaint function is not run when the image is moved. but i tried manually running the function and it didn't fix the problem.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source