Q:

Double buffering control causes grey to appear

I have a class that accepts a Control and draws generated images to it. In my application code I'm using a Panel control for this - which seems to work well, except that I get a lot of flickering on the control as the image is redrawn. I think the solution is to enable double buffering on the control. I'm doing this with the following code:
System.Reflection.PropertyInfo aProp =
                typeof(System.Windows.Forms.Control).GetProperty(
                    "DoubleBuffered",
                    System.Reflection.BindingFlags.NonPublic |
                    System.Reflection.BindingFlags.Instance);

            aProp.SetValue(drawControl, true, null); 

After adding this code, the image is drawn, and then immeadiately replaced with the default grey button background colour - it's as if the system is drawing over my own content. 
I remember seeing somewhere a property that tells the system to never draw the control (which would be perfect for me since I'm filling the entire control with content), but now I cannot find it. Is there such a property, and if so, how can I enable it?
I'm using C# with the .NET framework ver 4.0.

A:

Try setting FlatStyle on the control to FlatStyle.Standard, if it's currently set to FlatStyle.System.
(Setting DoubleBuffered by reflection looks horrible too, but perhaps you need to do that for some reason)

