In my main menu form, I'm using the UltraToolbarsManager and dynamically creating toolbars and buttontools. Here's what I do:
And repeat for each toolbar.
It works fine but it's slow, specifically when it creates the buttontools. It takes over 2 seconds to create 35 buttons. I'm also using an UltraTree and that creates over 700 nodes in about 0.15 seconds.
How can I make it quicker?
I tried this and it always works fine for me so I attached my sample to this post for you. Please review it and feel free to let me know if I misunderstood you or if you have any other questions.
I've found out that it's slow because I'm setting the buttons' image with
ButtonTool:SharedProps:AppearancesSmall:Appearance:Image = Bitmap:FromFile(cImagePath)
Would it be quicker if I use an ImageList, add all our default images into it and use an image in its collection? If a client has created their own images so it's not in the collection, I could still use same Bitmap:FromFile code.
I've tested a coule of things.
Using an ImageList, it takes 0.9 - 1.1 secs.
If I replace the Bitmap:FromFile with NEW Bitmap(cImagePath), it's 1.0 - 1.2 secs.
So it's down from over 2 secs but I'd like to make it under 0.5 sec.
I've found the cause of the problem.
In my code, I check if the image exists before choosing the image from the ImageList or loading it into a BitMap.
If I do the check only if the image isn't in the ImageList, the time drops to 0.18 secs.
Thank you for your feedback and for sharing this with us. We believe that the other community members could benefit from such threads.
Please feel free to let me know if a question about our toolset comes up on your mind.