Torna al Thread

ProgressBar oPB1; delegate void SetPBCallback(ProgressBar oPB); public frmLogin() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); oPB1 = new ProgressBar(); oPB1.Width = 190; oPB1.Location = new Point(292, 227); oPB1.Style = ProgressBarStyle.Marquee; oPB1.BringToFront(); } void startPB() { SetPB(oPB1); } private void SetPB(ProgressBar oPB) { if (this.panel1.InvokeRequired) { SetPBCallback d = new SetPBCallback(SetPB); this.Invoke(d, new object[] { oPB }); } else { panel1.Controls.Add(oPB1); } } void FrmLoginLoad(object sender, EventArgs e) { Thread thPB = new Thread(startPB); thPB.Start(); btnLogout.Enabled = false; hideControls(); this.Show(); while (this.Opacity < 1.0) this.Opacity += 0.02; showControls(); this.Refresh(); lblInfo.Text += "\nCaricamento versione..." ; lblInfo.Refresh(); //lblInfo.Text viene poi aggiunto di diverse informazioni man mano che esse vengono caricate }
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5