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...

MarvinBrenesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sarika30Commented:

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

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
muckeypuckCommented:
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.

see: http://msdn.microsoft.com/en-us/library/79eytxt5.aspx
0
srllemoCommented:
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)
                return;

            System.Reflection.PropertyInfo aProp =
                  typeof(System.Windows.Forms.Control).GetProperty(
                        "DoubleBuffered",
                        System.Reflection.BindingFlags.NonPublic |
                        System.Reflection.BindingFlags.Instance);

            aProp.SetValue(c, true, null);
        }
    }

Usage:

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

DoubleBufferedControl.Set(button);
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.