private void RePaint() { using (Graphics gr = this.CreateGraphics()) { for (int i = 0; i < draw.CurveCount; i++) { JADA.Curve tempcv = draw.GetCurve(i); Pen myPen = new Pen(Color.FromArgb(tempcv.Red, tempcv.Green, tempcv.Blue), tempcv.Width); for (int j = 0; j < tempcv.CoordinatesCount - 1; j++) { int X1 = new int(); int Y1 = new int(); int X2 = new int(); int Y2 = new int(); tempcv.GetCoordinate(j, ref X1, ref Y1); tempcv.GetCoordinate(j + 1, ref X2, ref Y2); Point pt1 = new Point(X1, Y1); Point pt2 = new Point(X2, Y2); gr.DrawLine(myPen, pt1, pt2); } myPen.Dispose(); } } }
public void Draw(JADA.Draw drwSelf) { int c, p; drwSelf.Duplicate(); myCurves.Add(drwSelf); this.Invoke(new MethodInvoker(delegate { using (Graphics gr = Graphics.FromHdc(GetDC(this.Handle))) { for (c = 0; c < drwSelf.CurveCount; c++) { JADA.Curve crvSelf = drwSelf.GetCurve(c); Color myColor = Color.FromArgb(crvSelf.Alpha, crvSelf.Red, crvSelf.Green, crvSelf.Blue); using (Pen myPen = new Pen(myColor, crvSelf.Width)) { if (crvSelf.CoordinatesCount > 1) { List <Point> points = new List <Point>(); for (p = 0; p <= crvSelf.CoordinatesCount - 1; p++) { int X = 0, Y = 0; crvSelf.GetCoordinate(p, ref X, ref Y); points.Add(new Point(X, Y - SystemInformation.CaptionHeight)); // JADA.Common.LogMessage(string.Format("DrawCurve: point {0} is {1},{2}\n", p, X, Y)); // winagent.Globals.jadaSelf.LogMessage(string.Format("DrawCurve: point {0} is {1},{2}\n", p, X, Y)); } gr.DrawCurve(myPen, points.ToArray(), 0.5f); } } } } })); }