师傅让我做个图
从3000到5000之间取出 200个随机数,每秒20个,然后实时显示,,各位高人们这个怎么做啊?

解决方案 »

  1.   

    有三种方式
    第一种、使用GDI+的graphic类;
    第二种、使用WPF的drawingvisual类;
    第三种、使用托管directx的device类。
    具体使用方法你可以看这些类的成员。
      

  2.   

    具体怎么去实现啊?我刚接触C#,不知道从哪儿下手,谁有个什么小例子啥的不?谢谢啊,我邮箱[email protected]
      

  3.   

    http://msdn.microsoft.com/zh-cn/library/ms771684(v=vs.90).aspx
      

  4.   


            int[] arr = new int[20];        private void timer1_Tick(object sender, EventArgs e)
            {
                Random rand = new Random();
                for (int i = 0; i < 20; i++)
                {
                    arr[i] = rand.Next(3000, 5000);
                }
                this.Invalidate();        }        private void DrawItems(int[] arr,Graphics g)
            {
                for (int i = 0; i < arr.Length; i++)
                {
                    g.DrawString(arr[i].ToString(), this.Font, new SolidBrush(Color.Red), 0, 20 * i);
                }
            }        private void Form1_Paint(object sender, PaintEventArgs e)
            {
                DrawItems(arr, e.Graphics);        }
      

  5.   


    public partial class Form1 : Form
    {
        Timer timer = new Timer();
        Random random = new Random();
        List<PointF> points = new List<PointF>();    public Form1()
        {
            InitializeComponent();
            this.DoubleBuffered = true;
            timer.Interval = 1000 / 20;
            timer.Tick += delegate { this.Invalidate(); };
            timer.Start();
        }    protected override void OnPaint(PaintEventArgs e)
        {
            const int SampleCount = 200, Min = 3000, Max = 5000;
            if (points.Count < SampleCount)
            {
                this.points.Add(new PointF(
                    this.Width / (SampleCount + 1.0f) * (1 + points.Count),
                    this.Height / (Max - Min + 1.0f) * (random.Next(Min, Max) - Min)
                ));
            }
            if (points.Count > 1)
            {
                e.Graphics.DrawLines(Pens.Blue, points.ToArray());
            }
        }
    }
      

  6.   

    谢谢大家
    那我在picturebox里显示那些怎么是一点一点的啊,用鼠标点一下那个窗口就出点,这是为什么呢?