在主要班级改变形式

时间:2016-05-15 13:37:43

标签: c# winforms

表单包含我想在类中更改的进度条,但最后一行什么都不做。进度条设置为public。有没有办法来解决这个问题? :)

namespace programname
{
   static class Program
   {
      static void Main()
      {    
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        //splash is my form
        Splash start = new Splash();
        Application.Run(start);
        start.progressBar1.Value = 21;
      }
   }
}

1 个答案:

答案 0 :(得分:0)

Splash start = new Splash();
start.progressBar1.Value = 21;
Application.Run(start);

或者

    Application.Run( new Splash() );

[Splash form]

public void Splash_load( object sender,EventArgs e)
{
     progressBar1.Value = 21;
}