資源簡介
穆運峰的多線程的例子.rar

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Drawing;
using?System.Drawing.Drawing2D;
using?System.Drawing.Imaging;
using?System.Threading;
namespace?BallBouncApp
{
????public?class?Ball
????{
????????public?Mutex?ballMutex;
????????public?Point?ptCenter;
????????public?Size?size;
????????public?Color?color;
????????public?bool?bContinue;
????????public?int?dx;
????????public?int?dy;
????????public?int?slp;
????????public?int?R;
????????public?Brush?br;
????????public?void?Draw(Graphics?g)
????????{
????????????g.FillEllipse(br?new?Rectangle(ptCenter.X?-?R?ptCenter.Y?-?R?2?*?R?2?*?R));
????????}
????????public?void?Move()
????????{
????????????while?(bContinue)
????????????{
????????????????ballMutex.WaitOne();
????????????????ptCenter.Y?+=?dy;
????????????????if?(ptCenter.Y?>=?size.Height?||?ptCenter.Y?<=?0)
????????????????{
????????????????????dy?=?-dy;
????????????????????ptCenter.Y?+=?dy;
????????????????}
????????????????ptCenter.X?+=?dx;
????????????????if?(ptCenter.X?>=?size.Width?||?ptCenter.X?<=?0)
????????????????{
????????????????????dx?=?-dx;
????????????????????ptCenter.X?+=?dx;
????????????????}
????????????????ballMutex.ReleaseMutex();
???????????????Thread.Sleep(slp);
????????????}
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????143??2018-01-02?10:30??說明.txt
?????文件???????1346??2018-01-01?22:31??BallBouncApp\BallBouncApp\Ball.cs
?????文件???????3772??2018-01-01?22:29??BallBouncApp\BallBouncApp\BallBouncApp.csproj
?????文件???????2884??2018-01-02?10:24??BallBouncApp\BallBouncApp\FormMain.cs
?????文件???????3584??2018-01-01?22:29??BallBouncApp\BallBouncApp\FormMain.Designer.cs
?????文件???????5817??2018-01-01?22:29??BallBouncApp\BallBouncApp\FormMain.resx
?????文件????????496??2018-01-01?20:41??BallBouncApp\BallBouncApp\Program.cs
?????文件???????1356??2018-01-01?20:41??BallBouncApp\BallBouncApp\Properties\AssemblyInfo.cs
?????文件???????2876??2018-01-01?20:41??BallBouncApp\BallBouncApp\Properties\Resources.Designer.cs
?????文件???????5612??2018-01-01?20:41??BallBouncApp\BallBouncApp\Properties\Resources.resx
?????文件???????1099??2018-01-01?20:41??BallBouncApp\BallBouncApp\Properties\Settings.Designer.cs
?????文件????????249??2018-01-01?20:41??BallBouncApp\BallBouncApp\Properties\Settings.settings
?????文件????????901??2018-01-01?22:38??BallBouncApp\BallBouncApp\UpDataUi.cs
?????文件????????878??2018-01-01?20:41??BallBouncApp\BallBouncApp.sln
????..A..H.?????21504??2018-01-02?10:25??BallBouncApp\BallBouncApp.suo
?????文件??????13938??1998-03-27?08:40??MtGdi02\bounce.cpp
?????文件???????3696??1998-03-27?08:40??MtGdi02\bounce.h
?????文件??????????1??2009-08-31?02:32??MtGdi02\ClassDiagram1.cd
?????文件???????3180??1998-03-27?08:40??MtGdi02\hello.cpp
?????文件???????1302??1998-03-27?08:40??MtGdi02\hello.h
?????文件????????766??1998-03-27?08:40??MtGdi02\hello.ico
?????文件???????5044??1998-03-27?08:40??MtGdi02\l.jpn\mtmdi.rc
?????文件???????1814??1998-03-27?08:40??MtGdi02\mainfrm.cpp
?????文件???????1344??1998-03-27?08:40??MtGdi02\mainfrm.h
?????文件????????519??1998-03-27?08:40??MtGdi02\makefile
?????文件??????23284??2014-01-07?16:29??MtGdi02\Mtgdi.aps
?????文件???????2430??1998-03-27?08:40??MtGdi02\mtgdi.clw
?????文件???????3037??1998-03-27?08:40??MtGdi02\mtgdi.cpp
?????文件???????7108??2013-11-29?09:14??MtGdi02\mtgdi.dsp
?????文件????????533??1998-03-27?08:40??MtGdi02\mtgdi.dsw
............此處省略73個文件信息
評論
共有 條評論