/// <summary> /// Устанавливает объект полотна /// </summary> /// <param name="obj"></param> public void SetObjectPaint(Control obj) { ObjectCanvas = obj; ObjectCanvas.Click += (s, e) => { var MouseEvent = (MouseEventArgs)e; if (MouseEvent.Button == MouseButtons.Left) { // GetLeftClick(new Point(MouseEvent.X, MouseEvent.Y)); } if (MouseEvent.Button == MouseButtons.Right) { // GetRightClick(new Point(MouseEvent.X, MouseEvent.Y)); } }; ObjectCanvas.MouseDown += (s, e) => { if (e.Button == MouseButtons.Left) { var p = new Point(e.X, e.Y); DragAndDrop.startDrag(p); GetLeftDown(p); } ObjectCanvas.Refresh(); }; ObjectCanvas.MouseUp += (s, e) => { if (e.Button == MouseButtons.Left) { var p = new Point(e.X, e.Y); DragAndDrop.endDrag(); GetLeftUp(p); } ObjectCanvas.Refresh(); }; ObjectCanvas.Resize += (s, e) => { Paint(); ObjectCanvas.Refresh(); }; ObjectCanvas.MouseMove += (s, e) => { if (CrossPoint.X != e.X || CrossPoint.Y != e.Y) { CrossPoint = new Point(e.X, e.Y); DragAndDrop.Check(CrossPoint); RedrawActual(); ObjectCanvas.Refresh(); } }; }