刚开始学c#,现在在用c#.net和oracl开发一个项目(一个信息管理系统),现在要在winform中画一个柱状图,数据通过查询数据库得到,现在在用GDI+做(也是从网上找得一些资料),但还是弄不出来,哪位高人能给我讲讲该怎么做啊,给个大体的代码最好,谢谢大家了,急用
解决方案 »
- 如何把“11/14/10 18:14:35”转换成系统认可的时间格式?
- 程序使用SQL数据库,是直接用代码操作好,还是使用向导添加数据源好呢?
- 如何读取一个utf-8的2进制文件,生成另外一个utf-8文本文件?
- 郁闷一天了,datalist控件不能触发事件?期待高手中的高手
- 下面的要求应该设置什么样的事务级别?
- 知道如何实现 TreeTable的请进(效果如 HGrid 就可以了),问题解决后,另有200分相赠!
- 在vs2003中如何生成安装文件??
- 这样用dataset为什么没有更新?
- 如何定时刷新DataSet?刷新要不要把原数据清空?
- 各位进来看看了!!!!
- 如何把图片读取为Byte()格式,然后通过webservice传给服务器
- ???DataGrid ????
http://www.codeproject.com/csharp/charting.asp
{
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;
}随便画了一个,应该是这个思路,你试试看
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();
}