Chinaunix首页 | 论坛 | 博客
  • 博客访问: 551754
  • 博文数量: 156
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1183
  • 用 户 组: 普通用户
  • 注册时间: 2013-11-22 11:42
文章分类

全部博文(156)

文章存档

2015年(67)

2014年(89)

分类: C#/.net

2014-11-28 20:30:05


  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.Threading;
  9. using System.Windows.Forms;

  10. namespace graphic
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.     
  19.         private void button1_Click(object sender, EventArgs e)
  20.         {
  21.             Graphics DrawInterface = panel1.CreateGraphics(); //在panel1里显示图像
  22.            // Pen MyPen = new Pen(Color.Blue, 5);
  23.             Pen MyPenControl = new Pen(Color.FromName("Control"), 5);
  24.             Pen MyPenBlue = new Pen(Color.Blue, 5);
  25.             Pen MyPenRed = new Pen(Color.Red, 5);

  26.             for (int i = 1; i < 30; i++)
  27.             {
  28.               //DrawInterface.DrawLine(MyPen, 100, 100, 200, 50 * i); //画直线:颜色, 粗细, (扇形)
  29.               // DrawInterface.DrawLine(MyPen, 100, 50 * i, 200, 50 * i); //画十条直线

  30.                 DrawInterface.DrawLine(MyPenBlue, 100 + 10 * i, 20 * i, 200 + 10 * i, 50 * i); //用不同颜色的笔交替画
  31.                 Thread.Sleep(500);
  32.                 DrawInterface.DrawLine(MyPenRed, 100 + 10 * i, 20 * i, 200 + 10 * i, 50 * i);
  33.                 Thread.Sleep(50);
  34.                 DrawInterface.DrawLine(MyPenControl, 100 + 10 * i, 20 * i, 200 + 10 * i, 50 * i);
  35.             }

阅读(648) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~