I have to disable the OnPaintBackground
on my TableLayoutPanel
to remove flickering caused from the background being drawn first(because I am drawing on the TLP with the paint method, and yes I need a TLP because it contains many controls for a purpose). So my code is as follows:
public static bool FlickerPanel = false;
public class FlickerTableLayoutPanel : TableLayoutPanel
{
protected override void OnPaintBackground(PaintEventArgs e)
{
if (FlickerPanel)
base.OnPaintBackground(e);
}
}
Then in my paint method I have it draw it's own background. So during runtime it is fine.
Edit: I discovered the root of the problem. By overriding the OnPaintBackground it disables whatever code is making the designer draw the background. If I remove the override all together it doesn't have the graphical glitch.
protected override void OnPaintBackground(PaintEventArgs e)
{
base.OnPaintBackground(e);
}
Even this above code disabled the Design view rendering and causes graphical glitches. Any help much appreciated!