0

I've tried this solution, but got "Invalid window handle" message.

Without

protected override void OnMove(EventArgs e)
{
    RecreateHandle(); //-- seems to be a problem
}

form is working, but pictureBox is without transparency.

What should I do?

Community
  • 1
  • 1
  • Well, it's quite a bad idea to destroy a window while it is being moved. PictureBox already supports transparency [pretty well](http://stackoverflow.com/a/5523359/17034). – Hans Passant Nov 15 '13 at 12:33
  • For immobilized sure, but not for moving pictureBox. PictureBox's transperacy is a layer created by parent image (so it's a camouflage). When pictureBox is moving, it's creating a new layer. Unfortunately, creating uncurrectly (picture is not maching with the original). Try to create a background layer (on form or another pictureBox) and a pictureBox with transparent .png (with png.BackColor = Color.Transparent and png.Parent = background_layer); make png move with timer (10 ms) and see how it works. That is why I'm looking for a solution to make pictureBox truly transperant. – user2995976 Nov 15 '13 at 17:57
  • The probable intention in that code was to just get the window to repaint. RecreateHandle does that but is the atom bomb approach. Use Invalidate() instead. – Hans Passant Nov 15 '13 at 18:15

0 Answers0