C# Call the same function with different values at the same time
I have a function that changes the text in a label for another one, showing the text transition effect. Imagine that I have 4 labe开发者_开发问答ls with texts, and I want to replace their texts with another different ones, showing the same effect but for the 4 labels at the same time, is there any way to do that? Call the same function with different values at the same time.
Thanks in >>
I would recommend using double-buffering to achieve this effect. You update the labels, and then use double-buffering to show the completed form. There are plenty of articles on enabling this for WinForms apps, and the concept is applicable to most UI platforms.
Windows UI (for WinForms at least) doesn't like to be updated from multiple threads, so I wouldn't bother trying to pursue that (unless you require a lot of background computation to get the new values)
You can modify your function to change all labels at once. Something like this:
Foreach EffectStep
Foreach Label
do some job
精彩评论