开发者

C# Call the same function with different values at the same time

开发者 https://www.devze.com 2023-03-14 22:21 出处:网络
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 a

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号