public void DrawLine() { DrawLine drawing = new DrawLine(); InputFileVector drawLine = new InputFileVector(); var brush = Brushes.Yellow; drawLine.a = " - 1,5; 3,4"; drawLine.b = "2,2; 5,7"; drawLine.color = "127; 255; 255; 255"; drawLine.lineType = "solid"; drawing.Color = brush; drawing.X1 = -1.5f; drawing.X2 = 3.4f; drawing.Y1 = 2.2f; drawing.Y2 = 5.7f; drawing.LineType = LineTypesValues.Solid; }
public void DrawLine(InputFileVector drawLine) { DrawLine drawing = new DrawLine(); var brush = FindBrushByARGB(drawLine.color); var xCoordinates = drawLine.a.Split(';'); var yCoordinates = drawLine.b.Split(';'); drawing.Color = brush; drawing.X1 = float.Parse(xCoordinates[0]); drawing.X2 = float.Parse(xCoordinates[1]); drawing.Y1 = float.Parse(yCoordinates[0]); drawing.Y2 = float.Parse(yCoordinates[1]); switch (Enum.Parse(typeof(System.Drawing.Drawing2D.DashStyle), FirstCharToUpper(drawLine.lineType))) { case System.Drawing.Drawing2D.DashStyle.Dash: drawing.LineType = LineTypesValues.Dash; break; case System.Drawing.Drawing2D.DashStyle.Dot: drawing.LineType = LineTypesValues.Dot; break; case System.Drawing.Drawing2D.DashStyle.Solid: drawing.LineType = LineTypesValues.Solid; break; case System.Drawing.Drawing2D.DashStyle.DashDot: drawing.LineType = LineTypesValues.DashDot; break; } Lines.Add(drawing); }