开发者

Panel containing PictureBox flickers on background change. How can I eliminate this?

开发者 https://www.devze.com 2023-03-06 01:01 出处:网络
I have a panel with the BackgroundImage set that I\'m using as a button. The panel also contains a PictureBox with a png image loaded so that parts of the image are transparent and the panel image sho

I have a panel with the BackgroundImage set that I'm using as a button. The panel also contains a PictureBox with a png image loaded so that parts of the image are transparent and the panel image shows through. On MouseDown I change the panels BackgroundImage, then on MouseUp I change it back again. The problem is that when the panel image changes, the PictureBox开发者_高级运维 flickers badly when redrawing its transparent areas.

I've tried using the DoubleBuffered property of the form its on; no luck there. I've also tried SuspendLayout just before changing the image, refreshing the PictureBox, then ResumeLayout. Still no luck.

Thanks in advance for any ideas.


It's the bad part of VS in graphic. Try using Form BackgroundImage property, or overrides OnPaint event and use Graphics class to draw the image manually (draw on the Form).

0

精彩评论

暂无评论...
验证码 换一张
取 消