Hi,
I have an UltraTabControl with 3 tabs. In the 2nd tab there are about 150 UltraLabels (all created at runtime). When I click the 2nd tab it takes about 13 seconds for the tab to show!
I have replaced the UltraLabel with the regular Label and then it works fine.
What causes this terrible performance? It's an unworkable situation atm. I have this problem with version 9.2.
Any help would be highly appreciated!
- Erik
Hi Erik,
Are the UltraLabels transparent? That would certainly cause a serious performance hit - that's just the nature of transparency in DotNet. But other than that, I can't see any reason why it should be slow.
Can you post a small sample project demonstrating the problem?
Labels are not transparent.
I attached a test project.
Thanks in advance!
I ran this through a performance profiler and the vast majority of the time this is taking is in the FlowLayoutPanel. For 51 controls on the FlowLayoutPanel, the panel itself is asking for the GetPreferredSize method more than18,000 times on the UltraLabels and another 6,000 times on the UltraCheckEditors.
Our controls take longer than the MS controls because they support a wider range of appearance features.
I tried using the UltraFlowLayoutManager instead of the Microsoft FlowLayoutPanel, and it seems to be a bit faster, since it only gets called 16,000 times. But the bottleneck is still the GetPreferredSize method on the label.
We should look into optimizing these methods. So, I'm going to forward this thread over to Infragistics Developer Support and ask them to write it up for developer review.
Hi Mike,
Is there any workaround I can use in the meanwhile as I need to get a release out.
I'm thinking about using the normal Label again, but that's not why I got the Infragistics package since all my controls are Infragistics and use the appstyler.
Just wanted to let you know, we have looked into this issue and found a workaround for you.
The basic problem here is that the UltraLabel has some optimization code to delay auto-sizing the control until it's Window Handle is created. I'm not entirely sure why this is, but it's probably based on the theory that there's no point in sizing a control that has not been displayed on the screen, yet.
Anyway, when you switch to the second tab, the Labels all become Visible and have their handles created one at a time. At this point, the label Auto-Sizes itself. This causes the FlowLayoutPanel to perform a layout. And it ends up doing this once for each label. So it's laying out all of the controls many times.
Anyway, you can work around this very easily by forcing the UltraLabel's Window handle to be created up front. Call the CreateControl method on each new UltraLabel control immediately after you create it, the problem goes away.
Hello Erik,
I have logged this behavior as a development issue.
I can't think of any workaround, since the problem is deep inside the control's code. Except maybe to not use a FlowLayout panel and simply position the controls yourself in code.
AppStyling can style the inbox Label control, by the way. You just have to place an InboxControlStyle on your form. And, of course, the inbox label only supports very simple styling like setting the forecolor and backcolor.