So, I'm pretty new to developing Windows forms.
I am trying to create a component βhey, I'm busy with businessβ, which simply rotates the form around itself. I want this control to be temporary and run on top of any other controls. The class is inherited directly from Control.
So, I have this in the constructor:
SetStyle(ControlStyles.Opaque, true);
and this:
protected override CreateParams CreateParams { get { CreateParams parms = base.CreateParams; parms.ExStyle |= 0x20; return parms; } }
Which gets me a control that will be drawn on top of other controls.
Now my problem is this. I redraw the control several times per second to create a smooth animation. However, I cannot figure out how to clear what was drawn in the previous frame. Using e.Graphics.Clear(Color.Transparent) in OnPaint turns the entire black control.
Is there a way to clear the drawn content of a control?
I noticed that resizing the control will clear the background.
Things that don't work
- Override OnPaintBackground to do nothing. Or just name base.OnPaintBackground. The same results.
snicker
source share