//Добавить прямоугольник public void AddRect(Point up, Point down) { sRect rect = new sRect(GetDeleateContainer(), up, down); shapelist.Add(rect); rect.Draw(); SynchronizeImage(); }
//Рисует временный прямоугольник средствами gdi32 public void TempRect(Point a, Point b) { IntPtr hdc = NativeMethods.GetDC(cnv.Handle); sRect Rect; 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)) { Rect = new sRect(GetDeleateContainer(), a, oldb); rect = Rect.GetRect(); NativeMethods.Rectangle(hdc, rect.X, rect.Y, rect.Width, rect.Height); } Rect = new sRect(GetDeleateContainer(), a, b); rect = Rect.GetRect(); NativeMethods.Rectangle(hdc, rect.X, rect.Y, rect.Width, rect.Height); oldb = b; NativeMethods.ReleaseDC(cnv.Handle, hdc); }