Question

this is my first ever question on this website but it has helped me a lot in the past.

i have a small (but annoying) problem with a project i am working on. i am using a picturebox control which loads a png file with transparent areas. the transparency part works perfectly fine, but i need the user to be able to drag this picturebox around with the mouse. the picturebox is contained within a panel with squares. the squares are drawn in an overridden OnPaint method of the panel.

the problem is that if i move the picturebox control, the area which is transparent does not draw the background fast enough and the squares are not drawn exactly where they should be. is there any way to get around this and make everything look nice and smooth?

i have attached a picture so that you can understand better what i am trying to say. for this example i am using just a line instead of the actual picture that i will be using so that everything is more obvious. notice the squares around the line, which are not in drawn properly.

http://s1084.photobucket.com/albums/j405/headbanging1638/?action=view&current=problem.jpg

ps: i am using color.transparent for the backcolor of the picturebox

Was it helpful?

Solution

Maybe you could try to invalidate the layout on mousemove to force a faster rate of redraw?

OTHER TIPS

I think pretty similar problem which I asked some time ago.

See my Question, and Answer which I accepted. I think it will help you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top