-1

I'm using onPaint with Invalidate() on timer_tick for repaints, how can I draw a background once which shouldn't be repainted with the rest?

I tried using pictureBoxes, but they appearantly draw OVER the onPaint, also I can't use transparent images.

SJ19
  • 1,933
  • 6
  • 35
  • 68
  • Can you show some of your code? – Cjen1 Oct 04 '15 at 10:30
  • Why would you want the background not be painted? It will be destroyed when when the system needs the repaint! - You could set the BackgroundImage for unchanging backgrounds, though.. - Also: It is totally unclear what you are aiming at when you talk about transparency. Please explain yourself a lot clearer or else we can't really help or advise..! – TaW Oct 04 '15 at 10:40
  • Since onPaint gets refreshed every 10ms, I hoped there was a way to draw certain things (like background) only once to reduce the load. – SJ19 Oct 05 '15 at 06:00

1 Answers1

0

The Windows Forms libary is quite terrible for such things. Because none of the display data are buffered, every repaint (if slow enough) is visible and flashy. Transparent images in general do not work as you want them to do. I don't exactly know what you are trying to accomplish eventually, but if you're just playing around with graphics, I would suggest you use something like the Win2D API. The Win2D API is quite similar to the onPaint event in terms of usage.

I mean, in theory you can use Regions to make things transparent, but they can't make things like 50 % transparent but only completely. I tried doing fancy graphics with Windows Forms a few years back, and I can really not advise to do so.

georch
  • 959
  • 7
  • 18
  • You can always set doublebuffered to true but without knowing a lot more any advice seems futile – TaW Oct 04 '15 at 10:47
  • @georch As TaW said, I set doublebuffered to true and I must say it's pretty fluent. Does Monogame perhaps have any functions for this? – SJ19 Oct 05 '15 at 06:04