Advertisement
Guest User

Untitled

a guest
Apr 8th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Threading;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public class MyThread : Form1
  16.         {
  17.             public void Thread1()
  18.             {
  19.                 Graphics graph = this.CreateGraphics();
  20.                 Pen piros = new Pen(Color.Red);
  21.                 Point p1 = new Point(10, 10);
  22.                 Point p2 = new Point(20, 10);
  23.                 for (int i = 20; i < 100; i += 10)
  24.                 {
  25.                     graph.DrawLine(piros, 10, 10, i, 10);
  26.                     Thread.Sleep(500);
  27.                 }
  28.             }
  29.         }
  30.         public Form1()
  31.         {
  32.             InitializeComponent();
  33.         }      
  34.  
  35.         private void button1_Click(object sender, EventArgs e)
  36.         {
  37.             MyThread thr1 = new MyThread();
  38.             Thread t1 = new Thread(new ThreadStart(thr1.Thread1));
  39.             t1.Start();
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement