
private void Kxian_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen p = new Pen(Color.Red, 1);//上涨
Pen p1 = new Pen(Color.Green, 1);//下跌
g.DrawRectangle(p, 80, 80, 600, 400);
//k线开始
Font myFont = new Font("微软雅黑", 8);
//float angle = 20; //角度
float x = 0;
string begindate = null;
string jintian = DateTime.Now.ToShortDateString().ToString();
DataSet ds = null;
DataTable dt = null;
string sql = "select top 10 begindate,dayopen,dayclose,dayhigh,daylow from datetest where begindate<='" + jintian + "' order by begindate desc";
ds = db.getds(sql, "mminfo");
dt=ds.Tables[0];
int changdu = 600/dt.Rows.Count;
for (int i = 0; i < dt.Rows.Count; i++)
{
g.DrawLi
C# 实现动态连接数据库绘制K线图表

本文介绍了如何使用C#编程,在Visual Studio Code中连接SQL数据库,动态读取K线数据并进行绘制。通过理解矩阵数据结构,实现了K线图的绘制过程。
最低0.47元/天 解锁文章
333

被折叠的 条评论
为什么被折叠?



