【问题标题】:Showing up DataProcessing on SplashScreen Label c#在 SplashScreen 标签 c# 上显示 DataProcessing
【发布时间】:2021-01-23 04:09:20
【问题描述】:

屏幕已经完成我使用了 Devexpress SplashScreen。它在开始时打开并在加载所有数据时关闭,直到主应用程序打开。现在我的问题是如何将后台加载的数据放入标签中,以便用户看到正在发生的事情。

【问题讨论】:

    标签: c# splash-screen


    【解决方案1】:

    查看SplashScreenManager.SendCommand 以了解应用程序和启动屏幕之间的通信

    表单代码

            private void btnShowSplashScreen_Click(object sender, EventArgs e) {
                // Open a Splash Screen
                SplashScreenManager.ShowForm(this, typeof(SplashScreen1), true, true, false);
    
                // The splash screen will be opened in a separate thread. To interact with it, use the SendCommand method.
                for (int i = 1; i <= 100; i++) {
                    SplashScreenManager.Default.SendCommand(SplashScreen1.SplashScreenCommand.SetProgress, i);
                    //To process commands, override the SplashScreen.ProcessCommand method.
                    Thread.Sleep(25);
                }
    
                // Close the Splash Screen.
                SplashScreenManager.CloseForm(false);
            }
    

    启动代码

            public override void ProcessCommand(Enum cmd, object arg) {
                base.ProcessCommand(cmd, arg);
                SplashScreenCommand command = (SplashScreenCommand)cmd;
                if (command == SplashScreenCommand.SetProgress) {
                    int pos = (int)arg;
                    progressBarControl1.Position = pos;
                }
            }
    
    
            public enum SplashScreenCommand {
                SetProgress,
                Command2,
                Command3
            }
        
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-20
      • 2021-04-10
      • 1970-01-01
      相关资源
      最近更新 更多