SIGN UP MEMBER LOGIN:    
ARTICLE

Drawing Shapes using Threading

Posted by Indika M W Articles | Multithreading in C# October 25, 2002
This is simple multi-threading program that draws circles and rectangles. Each shape is handle by individual thread that created every time you press start button. Using sleep method on each thread we can change the speed of each shape.
Reader Level:
Download Files:
 

This is simple multi-threading program that draws circles and rectangles. Each shape is handle by individual thread that created every time you press start button. Using sleep method on each thread we can change the speed of each shape.

I have used VS.NET to implement this program. Double click on Thread_Example.Zip and extract all the files and folders to a folder in C drive.

Run the project using VS.NET:

Double click on ThreadTester.sln (Prject file). Then run the project (press F5). The Form1 will appear as shown below.

Run using command-line prompt.

Copy all the .cs files (From1.cs, Rectangle.cs, Circle.cs and Shapes.cs) in to a folder in C drive and comple it using

C:\FolderName> csc *.cs
This will create a Form1.exe file inside the folder. Then double click it run it.

 

  1. Select the shape from the drop down list: Rectangle or Circle
  2. Then choose the speed from the drop down list.
  3. Then choose a colour by clicking the colour button.
  4. Then press start, which will start the relevant shape.
  5. Press exit when you want to exit.

Login to add your contents and source code to this article
share this article :
post comment
 

I want to download this source code.

Posted by Rajiv Ranjan Sharma Aug 18, 2009
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Nevron Gauge for SharePoint
Become a Sponsor