//Рисует временный эллипс средствами gdi32 public void TempEllipse(Point a, Point b) { IntPtr hdc = NativeMethods.GetDC(cnv.Handle); sCircle Circle; Rectangle rect; NativeMethods.SetROP2(hdc, NativeMethods.R2_NOT); NativeMethods.SelectObject(hdc, NativeMethods.GetStockObject(NativeMethods.HOLLOW_BRUSH)); if ((oldb.X != int.MinValue) & (oldb.Y != int.MinValue)) { Circle = new sCircle(GetDeleateContainer(), a, oldb); rect = Circle.GetRect(); NativeMethods.Ellipse(hdc, rect.X, rect.Y, rect.Width, rect.Height); } Circle = new sCircle(GetDeleateContainer(), a, b); rect = Circle.GetRect(); NativeMethods.Ellipse(hdc, rect.X, rect.Y, rect.Width, rect.Height); oldb = b; NativeMethods.ReleaseDC(cnv.Handle, hdc); }
//Добавить эллипс public void AddEllipse(Point up, Point down) { sCircle circle = new sCircle(GetDeleateContainer(), up, down); shapelist.Add(circle); circle.Draw(); SynchronizeImage(); }