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

全部博文(156)

文章存档

2015年(67)

2014年(89)

分类: C#/.net

2014-11-28 16:52:53


  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.         private void button1_Click(object sender, EventArgs e)
  19.         {
  20.             Graphics DrawInterface = panel1.CreateGraphics(); //在panel1里显示图像

  21.             Pen MyPenControl = new Pen(Color.FromName("Control"), 5);
  22.             Pen MyPenBlue = new Pen(Color.Blue, 5);
  23.             Pen MyPenRed = new Pen(Color.Red, 5);

  24.             for (int i = 1; i < 25; i++)
  25.             {
  26.                 Rectangle TempRect = new Rectangle(100 + 10 * i, 20 * i, -100, -100);
  27.                 DrawInterface.DrawEllipse(MyPenRed, TempRect);
  28.                 Thread.Sleep(100);
  29.                 DrawInterface.DrawEllipse(MyPenBlue, TempRect); //用不同颜色的笔交替画
  30.                 Thread.Sleep(20);
  31.                 DrawInterface.DrawEllipse(MyPenControl, TempRect);
  32.             }
  33.         
  34.     }
  35. }

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