private void OnDocumentDragDrop(object sender, System.Windows.Forms.DragEventArgs e) { if (!e.Data.GetDataPresent(typeof(ShapeTemplate))) { return; } if (document == null) { return; } ShapeTemplate template = (ShapeTemplate)e.Data.GetData(typeof(ShapeTemplate)); Point ptClient = document.PointToClient(new Point(e.X, e.Y)); PointF ptDoc = document.ClientToDoc(ptClient); Box box = document.CreateBox(ptDoc.X, ptDoc.Y, defaultBoxSize.Width, defaultBoxSize.Height); box.Style = BoxStyle.Shape; box.Shape = template; }