刚开始学c#,现在在用c#.net和oracl开发一个项目(一个信息管理系统),现在要在winform中画一个柱状图,数据通过查询数据库得到,现在在用GDI+做(也是从网上找得一些资料),但还是弄不出来,哪位高人能给我讲讲该怎么做啊,给个大体的代码最好,谢谢大家了,急用

解决方案 »

  1.   

    ref:
    http://www.codeproject.com/csharp/charting.asp
      

  2.   

    恩,既然有数据,用GDI+的Graphics画就是了,最近我也遇到一个小问题呢, 那是0平面的,我想用gdi+画个立体感的圆拄图,没找到思路
      

  3.   

    private void Draw()
            {
                Bitmap bit = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height);
                Graphics g = Graphics.FromImage(bit);
                Pen tpen = new Pen(new SolidBrush(Color.Red));
                Brush tb = new SolidBrush(Color.Red);
                Brush uptb = new SolidBrush(Color.LightPink);
                Rectangle rect = new Rectangle(new Point(100, 101), new Size(100, 50));            g.FillEllipse(tb, new Rectangle(new Point(100,300),new Size(100,50)));
                g.FillRectangle(tb, new Rectangle(new Point(100, 125), new Size(100, 200)));
                g.FillEllipse(uptb,new Rectangle(new Point(120,200),new Size(5,50)));
                g.FillEllipse(uptb,rect);            this.pictureBox1.Image = bit;
            }随便画了一个,应该是这个思路,你试试看
      

  4.   

    我也画了一个,不过是太"正点"了 ^-^ ,应该斜一点,不然还是太难看了,楼上兄弟的画得也不错,哈
    using System.Drawing.Drawing2D; protected override void OnPaint(PaintEventArgs e)
            {
                base.OnPaint(e);            DrawVertPipe(e.Graphics);        }
            private void DrawVertPipe(System.Drawing.Graphics g)
            {
                System.Drawing.Drawing2D.GraphicsContainer gCon;
                gCon = g.BeginContainer();
                Rectangle bound = new Rectangle(50, 50, 50, 50);
                GraphicsPath gp = new GraphicsPath();
                g.SmoothingMode = SmoothingMode.AntiAlias;
                gp.AddRectangle(bound);
                g.FillPath(new SolidBrush(Color.Violet), gp);
                FillCylinderShadow(g, gp, 0.5f, Color.FromArgb(100, 0, 0, 0), Color.FromArgb(100, Color.White));
                gp.Dispose();
                g.EndContainer(gCon);
            }
            public void FillCylinderShadow(Graphics g, GraphicsPath gp, float focus, Color BeginColor, Color EndColor)
            {            LinearGradientBrush linGrBrush = new LinearGradientBrush(
                gp.PathPoints[0], gp.PathPoints[1],
                BeginColor,
                EndColor
                );
                linGrBrush.SetSigmaBellShape(focus);
                g.FillPath(linGrBrush, gp);            linGrBrush.Dispose();
            }