????? ????? ??????? ??? ?????? ??????? ???????? ?? 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# ?? ?????? ???????
- ??? ????? Microsoft Visual Studio .NET Microsoft Visual Studio 2005 ?? Microsoft Visual C# 2005 Express Edition.
- ????? ????? ??????? Visual C# ?? Windows ???? ???? ThreadWinApp.
- ????? ???? ???? ?? ??? ???????. ???? ???????? ???? ???? Button1.
- ????? ???? ProgressBar ??? ???????. ???? ???????? ???? ???? ?????? ProgressBar1.
- ???? ??? ?????? ?????? ??? ??????? ?? ???? ??? ??? ???.
- ????? ??????? ??????? ??? ????? ?????:
- ????? ????? ????? ?????? ???? ?? ??? Button1:
private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("This is the main thread");
} - ????? ??????? ?????? ??? ??? Form1:
- ??? ??????? ?????? ??? ??? 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 ???? ????? ??? ?? ?????. - ????? ????? ????? Load ??????? ?? ??? Form1. ??? ???????? ???????? ????? ???? ????? ???? ???? ???? ??????? ???? ????? ????? ? ?? ??? ????? ???? ?????.
private void Form1_Load(object sender, System.EventArgs e)
{
Thread trd = new Thread(new ThreadStart(this.ThreadTask));
trd.IsBackground = true;
trd.Start();
}
???? ?? ??? ????
- ?????? ??????? ???????. ???? ???? ?????? ?? ProgressBar1 ???? ??????. ??? ?? ???? ????? ???? ?? ???????.
- ???? ?? ???? ??????? ??????? ?????? ?? ???? ????? ???? ?????? ?????? ProgressBar1 ? ???? ??? ???? ?? ???????. ???? ???? ???? ????? ????? ???????:
????? ??? ???????. ???? ?? ?????? ??
ProgressBar1 ????? ?? ?????.
??????? ????? ????????
?? ??????? ???? ??????? ???? ?? ?????? ?????? ????? ?????? ??? ?????? ??? ??????? ????????. ????? ?? ?????????? ???? ????
????? ? ???????? ??? ????? ?? ????? Visual C# ".NET ????????? ??? ??????".
????? ?? ?????????? ?? ?????? ???? Microsoft ?????? ??? ????? ?? ????? SDK .NET Framework:
???? ???????: 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
(http://support.microsoft.com/kb/815804/en-us/
)