Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Threading;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public class MyThread : Form1
- {
- public void Thread1()
- {
- Graphics graph = this.CreateGraphics();
- Pen piros = new Pen(Color.Red);
- Point p1 = new Point(10, 10);
- Point p2 = new Point(20, 10);
- for (int i = 20; i < 100; i += 10)
- {
- graph.DrawLine(piros, 10, 10, i, 10);
- Thread.Sleep(500);
- }
- }
- }
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- MyThread thr1 = new MyThread();
- Thread t1 = new Thread(new ThreadStart(thr1.Thread1));
- t1.Start();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement