How to Create buttons runtime but is very slow

Our application was designed in VS2003, but now upgrade our application to VS2008
When this button is created, this redraw very time.
our application is food services contain in Tab Control
like    [ Food ] [  Desserts ] [ BarMenu ]
[Food1][Food2]      [Dessert1][Dessert2]      [Beer1][Beer2] ..etc
..etc                       etc...                                etc..
when the user change el tab index, all bottons redraw very time, every menu (tab) have 4x7 buttons;
our users say this very slow that previous version ( vs2003 )
we try  DoubleBuffered = True;

Do you have any answer for that...

Who is Participating?
Sarika30Connect With a Mentor Commented:

Make sure your backgroundcolor is not set to 'transparent'. Set to 'white' for better performance.

Also, do backgroundimagelayout to be either 'center' or 'streach' to increase performance. This will enable the double buffer on the form

muckeypuckConnect With a Mentor Commented:
There's also a way to clip and render certain parts. So for example if only 1 button changed theres a clipping property(i think this is it but im totally going off the top of my head)  that lets you update just the parts that changed.

Yea it is clipping.

srllemoConnect With a Mentor Commented:
you can try with this :

    public static class DoubleBufferedControl
        public static void Set(Control c)
            // To avoid flickering in case of remote sessions like remote desktop avoid double buffering
            //In case of local session turn on double buffering
            // Doublebuffered is property of  Control class so we use Reflection

            if (SystemInformation.TerminalServerSession)

            System.Reflection.PropertyInfo aProp =
                        System.Reflection.BindingFlags.NonPublic |

            aProp.SetValue(c, true, null);


in your code after creating button try call static method set of given class:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.