您现在的位置是:首页 > 综合知识网站首页综合知识

冲压件图纸符号(冲压件图纸)

  • 综合知识
  • 2024-07-21 09:50:02
  • 来源:
导读 大家好,小豆豆来为大家解答以上的问题。冲压件图纸符号,冲压件图纸这个很多人还不知道,现在让我们一起来看看吧!1、Y轴和X轴都是动态的画...

大家好,小豆豆来为大家解答以上的问题。冲压件图纸符号,冲压件图纸这个很多人还不知道,现在让我们一起来看看吧!

1、Y轴和X轴都是动态的画的,如果Y轴是静态的还对的上刻度,换成动态后就跟刻度差距很大了,数据全是数据库取出来的。

2、 我写的代码如下: g.DrawLine(new Pen(new SolidBrush(Color.Black), 1), 50, 55, 50, 300); //y轴 g.DrawLine(new Pen(new SolidBrush(Color.Black), 1), 50, 300, 710, 300); //x轴 double max = 3.70;//y轴刻度最大值 double min = 2.70;//y轴刻度最小值 //通过数组循环画Y轴的刻度 float[] m = new float[6]; m[5] = float.Parse(min.ToString()); float[] n = new float[6]; n[0] = 55f; for (int i = 1; i < 6; i++) { n[i] = n[i - 1] + (300 - 55) / 5; } for (int i = 5; i >0; i--) { m[i - 1] = m[i] + (float.Parse(max.ToString()) - float.Parse(min.ToString())) / 5; } for (int i = 5; i >=0; i--) { g.DrawLine(new Pen(new SolidBrush(Color.Black), 1), 50, n[i], 45, n[i]); g.DrawString(m[i].ToString(), new Font("宋体", 9), Brushes.Black, 20, n[i] - 4); } 这上面的是动态画y轴的刻度; StringFormat drawFormat = new StringFormat(); drawFormat.FormatFlags = StringFormatFlags.DirectionVertical; float nx; for (int y = 0; y < sMoth.Count; y++) //循环通过数据绘制柱型图 { for (int i = 0; i < iXiaoSH.Count; i++) { nx=(300 - 55) / 5+iXiaoSH[i] *10;//就这里算不到 //绘制Bar图 g.DrawRectangle(Pens.Black, (i * (710 - 50) / sMoth.Count) + 50, 300-nx//y坐标, 710 / sMoth.Count - 3, nx//高度); //以指定的色彩填充Bar图 g.FillRectangle(new SolidBrush(Color.Red), (i * (710 - 50) / sMoth.Count) + 51,300-nx + 1//y坐标, 710 / sMoth.Count - 4, nx - 1nx//高度); //显示Bar图代表的数据 g.DrawString(iXiaoSH[i].ToString(), new Font("宋体", 9), Brushes.Black, (i * (710 - 50) / sMoth.Count) + 51, 300-nx); //x轴刻度 g.DrawLine(new Pen(new SolidBrush(Color.Black), 1), ((i * (710 - 50) / sMoth.Count) + 50) + (710 / sMoth.Count)-3.5f , 300, ((i * (710 - 50) / sMoth.Count) + 50) + (710 / sMoth.Count)-3.5f, 305); } //x轴文字 g.DrawString(sMoth[y].ToString(), new Font("宋体", 9), Brushes.Black,((y * (710 - 50) / sMoth.Count) + 50) + (710 / sMoth.Count) - 10 ,305 ,drawFormat); } 这是通过数据画的柱状图,就是y坐标和高度那里算不出来,和刻度差距很大!。

本文到此分享完毕,希望对大家有所帮助。

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。
Top