public bool MouseUp(MouseButtons button, PointF location, PointF revertPoint, PointF revertDownPoint) { if (_studio.IsGrid) { revertPoint = Tool.GetGridPointF(revertPoint); revertDownPoint = Tool.GetGridPointF(revertDownPoint); } if (_state != CreateState.NotCreate) { if (!_isNodeCreate) { if (_state == CreateState.HasCreate) { revertPoint = GetOrthoSquarePoint(revertDownPoint, revertPoint); _studio.DrawFrame(PointF.Empty, PointF.Empty, FrameStyle.Thick, true); IDrawObj obj = _studio.StudioCreateDrawObj(_type, Tool.GetRectF(revertDownPoint, revertPoint)); if (obj != null) { obj.Invalidate(); } End(); _studio.Container.Framework.Manager.ResetToolboxPointerFunction(); } } return(true); } return(false); }
private void HMIForm_DragDrop(object sender, DragEventArgs e) { if (e.Effect != DragDropEffects.Copy) { return; } if (e.Data.GetDataPresent(typeof(ToolboxItem))) { _studio.Create.End(); ToolboxItem item = (ToolboxItem)e.Data.GetData(typeof(ToolboxItem)); string name = item.TypeName + "," + item.AssemblyName; Type t = Type.GetType(name); if (t == null) { return; } Point p = PointToClient(new Point(e.X, e.Y)); _studio.StudioCreateDrawObj(t, new RectangleF(p, new SizeF(100, 100))); Framework.Manager.ResetToolboxPointerFunction(); } }