Answer the question
In order to leave comments, you need to log in
How can I clear the Panel of what I've drawn without erasing the background image?
Panel.Invalidate();
Does not help. Because I'm redrawing multiple times per second and it's redrawing when the key is released.
Panel.Clear(Color.Teal);
Does not help. Draws the entire screen . Doesn't help. Same as the point above. Draws the screen, and the background image. Helps, but also redraws the background image.
What should I do?
Panel.Clear(Color.FromArgb(255));
Panel.Refresh();
Answer the question
In order to leave comments, you need to log in
You place the background image in a bitmap and, when redrawing from it, draw it on the control canvas. Draw only what you need:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
var g = e.Graphics;
var clipRect = e.ClipRectangle;
...
}
Invalidate(Rectangle.Round(rect));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question