????? ????? ???? ????? ???????? Visual C#

?????? ????????? ?????? ?????????
???? ???????: 815804 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

????? ????? ??????? ??? ?????? ??????? ???????? ?? Microsoft Visual C# .NET ?? ?? Microsoft Visual C#. ???? ??? ??????? ??? ???? ????? Visual C# ???? ????? ?????? ??????? ????????.

???????

???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ???? ???????:
  • ???? ??????? Microsoft Windows 2000 ?? Microsoft Windows XP ?? Microsoft Windows Server 2003
  • Microsoft Visual C# .NET ?? Microsoft Visual C# 2005
????? ??? ??????? ??? ??????? ??? ???????? ???????:
  • Visual C# ???????
  • Visual Studio .NET ????????? ????? ???? (IDE) ?? IDE 2005 Visual Studio

????? ????? Visual C# ?? ?????? ???????

  1. ??? ????? Microsoft Visual Studio .NET Microsoft Visual Studio 2005 ?? Microsoft Visual C# 2005 Express Edition.
  2. ????? ????? ??????? Visual C# ?? Windows ???? ???? ThreadWinApp.
  3. ????? ???? ???? ?? ??? ???????. ???? ???????? ???? ???? Button1.
  4. ????? ???? ProgressBar ??? ???????. ???? ???????? ???? ???? ?????? ProgressBar1.
  5. ???? ??? ?????? ?????? ??? ??????? ?? ???? ??? ??? ???.
  6. ????? ??????? ??????? ??? ????? ?????:
    using System.Threading;
  7. ????? ????? ????? ?????? ???? ?? ??? Button1:
    private void button1_Click(object sender, System.EventArgs e)
    {
    	MessageBox.Show("This is the main thread");
    }
  8. ????? ??????? ?????? ??? ??? Form1:
    private Thread trd;
    
  9. ??? ??????? ?????? ??? ??? Form1: ???
    private void ThreadTask()
    {
    	int stp;
    	int newval;
    	Random rnd=new Random();
    
    	while(true)
    	{
    		stp=this.progressBar1.Step*rnd.Next(-1,2);
    		newval = this.progressBar1.Value + stp;
    
    		if (newval > this.progressBar1.Maximum)
    			newval = this.progressBar1.Maximum;
    		else if (newval < this.progressBar1.Minimum)
    			newval = this.progressBar1.Minimum;
    		
    		this.progressBar1.Value = newval;
    
    		Thread.Sleep(100);
    	}
    }
    ?????? ??? ?? ??? underlies ???? ???????. ??? ????? infinite ???? ??? ?????? ???????? ?? decrements ?????? ?? ProgressBar1 ??? ?? ????? ????? 100 ???? ????? ??? ?? ?????.
  10. ????? ????? ????? Load ??????? ?? ??? Form1. ??? ???????? ???????? ????? ???? ????? ???? ???? ???? ??????? ???? ????? ????? ? ?? ??? ????? ???? ?????.
    private void Form1_Load(object sender, System.EventArgs e)
    {
    	Thread trd = new Thread(new ThreadStart(this.ThreadTask));
    	trd.IsBackground = true;
    	trd.Start();
    }

???? ?? ??? ????

  1. ?????? ??????? ???????. ???? ???? ?????? ?? ProgressBar1 ???? ??????. ??? ?? ???? ????? ???? ?? ???????.
  2. ???? ?? ???? ??????? ??????? ?????? ?? ???? ????? ???? ?????? ?????? ProgressBar1 ? ???? ??? ???? ?? ???????. ???? ???? ???? ????? ????? ???????:
    This is the main thread
????? ??? ???????. ???? ?? ?????? ?? ProgressBar1 ????? ?? ?????.

??????? ????? ????????

?? ??????? ???? ??????? ???? ?? ?????? ?????? ????? ?????? ??? ?????? ??? ??????? ????????. ????? ?? ?????????? ???? ???? ????? ? ???????? ??? ????? ?? ????? Visual C# ".NET ????????? ??? ??????".

?????

????? ?? ?????????? ?? ?????? ???? Microsoft ?????? ??? ????? ?? ????? SDK .NET Framework:
"???? ??????? ???"
http://msdn2.microsoft.com/en-us/library/system.threading.thread(vs.71).aspx

???????

???? ???????: 815804 - ????? ??? ??????: 07/?????/1428 - ??????: 2.10
????? ???
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Visual C# .NET 2003 Standard Edition
  • Microsoft ADO.NET 1.0
  • Microsoft Common Language Runtime (included with the .NET Framework) 1.0
  • Microsoft Visual C# 2005 Express Edition
????? ??????: 
kbmt kbnamespace kbthreadsync kbthread kbhowtomaster KB815804 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????815804

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com