简体   繁体   中英

c# - transparency not being drawn properly (fast enough)

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

也许您可以尝试使mousemove上的布局无效以强制加快重绘速度?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM