|
@@ -206,21 +206,10 @@ namespace OTSMeasureApp
|
|
|
width = rectangle.Width;
|
|
|
height = rectangle.Height;
|
|
|
bitmap = new Bitmap(width, height);
|
|
|
- //创建Graphics类对象
|
|
|
- //var graphics = Graphics.FromImage(bitmap);
|
|
|
- // //清空图片背景色
|
|
|
- // //graphics.Clear(Color.White);
|
|
|
- // Font font = new System.Drawing.Font("Arial", 9, FontStyle.Regular);
|
|
|
-
|
|
|
- // Brush brush2 = new SolidBrush(Color.SaddleBrown);
|
|
|
- // Brush brushPoint = new SolidBrush(Color.Red);
|
|
|
-
|
|
|
- // Pen mypenRed = new Pen(Color.Red, 1);
|
|
|
+
|
|
|
Pen mypenYellow = new Pen(Color.Yellow, 0.001f);//点颜色
|
|
|
|
|
|
- //画曲线
|
|
|
- //if (drawflag == 1)
|
|
|
- //{
|
|
|
+
|
|
|
int len = buf.Length;
|
|
|
PointF[] CurvePointF = new PointF[len];//坐标点
|
|
|
float pointX = 0;
|
|
@@ -230,7 +219,7 @@ namespace OTSMeasureApp
|
|
|
pointX = (picBox.Width - rectangle.Width) / 2 + Convert.ToSingle(i * rate);
|
|
|
float imagei = (int)GrayLevel.Max - Convert.ToInt32(buf[i]);
|
|
|
float imagerate = (Convert.ToSingle(Convert.ToDouble(rectangle.Height) / 510));
|
|
|
- pointY = imagei * imagerate + (rectangle.Height) / 4;
|
|
|
+ pointY = imagei * imagerate + (rectangle.Height) / 4+rectangle.Top;
|
|
|
if (pointY > ((rectangle.Height) * 3 / 4))
|
|
|
{
|
|
|
float ii = pointY;
|
|
@@ -241,7 +230,7 @@ namespace OTSMeasureApp
|
|
|
float Tension = 0.001f;
|
|
|
e.Graphics.DrawCurve(mypenYellow, CurvePointF, Tension);//画曲线
|
|
|
|
|
|
- //}
|
|
|
+
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
@@ -1109,31 +1098,20 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
Point start = new Point(100, pointStart.Y);
|
|
|
Point end = new Point(500, pointEnd.Y);
|
|
|
- //int lens = curvebuf.Length;
|
|
|
-
|
|
|
- //if (lens <= 1)
|
|
|
- //{
|
|
|
- // drawflag = 0;
|
|
|
- // MessageBox.Show(table["message22"].ToString(), table["message23"].ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- //drawflag = 1;
|
|
|
- //Y值
|
|
|
+
|
|
|
double rate = (double)picBox.Image.Height / (double)rectangle.Height;
|
|
|
int YSize = Convert.ToInt32((rate * (double)pointStart.Y));
|
|
|
//显示线扫描 黄色线的曲线数据
|
|
|
|
|
|
var Imagedata = new byte[m_iWidth];
|
|
|
GetYSize();
|
|
|
- //获取行数据
|
|
|
- //GetLineImage(YSize, m_iWidth, ref Imagedata);
|
|
|
+
|
|
|
GetLineImage(YSize, m_iWidth, ref Imagedata);
|
|
|
|
|
|
|
|
|
|
|
|
DrawCurve(Imagedata, e);
|
|
|
- //}
|
|
|
+
|
|
|
e.Graphics.DrawLine(new Pen(Color.Red), new Point(rectangle.X, rectangle.Y + (rectangle.Height) / 4), new Point(rectangle.X + rectangle.Width, rectangle.Y + (rectangle.Height) / 4));
|
|
|
e.Graphics.DrawLine(new Pen(Color.Red), new Point(rectangle.X, rectangle.Y + rectangle.Height * 3 / 4), new Point(rectangle.X + rectangle.Width, rectangle.Y + rectangle.Height * 3 / 4));
|
|
|
e.Graphics.DrawLine(new Pen(Color.Blue), new Point(rectangle.X, pointStart.Y), new Point(rectangle.X + rectangle.Width, pointEnd.Y));
|