private void PaintDraggedItem(MNPageContext context, PVDragContext mouseContext) { if (mouseContext.draggedItem != null) { SMTokenItem ti = mouseContext.draggedItem; if (ti.Text != null && ti.Text.Length > 0) { if (ti.ContentSize.Width == 0) { SizeF sf = context.g.MeasureString(ti.Text, context.DragItemFont); ti.ContentSize = new Size(Convert.ToInt32(sf.Width), Convert.ToInt32(sf.Height)); } Rectangle rc = new Rectangle(mouseContext.lastPoint.X - ti.ContentSize.Width / 2, mouseContext.lastPoint.Y - ti.ContentSize.Height / 2, ti.ContentSize.Width + 2, ti.ContentSize.Height + 2); //context.g.FillRectangle(Brushes.LightPink, rc); context.g.DrawString(ti.Text, context.DragItemFont, Brushes.Red, rc); } else if (ti.Image != null) { if (ti.ContentSize.Width == 0) { Size sf = ti.Image.Size; double d = 64.0 / (Math.Max(sf.Width, sf.Height) + 1); ti.ContentSize = new Size(Convert.ToInt32(d * sf.Width), Convert.ToInt32(d * sf.Height)); } Rectangle rc = new Rectangle(mouseContext.lastPoint.X - ti.ContentSize.Width / 2, mouseContext.lastPoint.Y - ti.ContentSize.Height / 2, ti.ContentSize.Width + 2, ti.ContentSize.Height + 2); context.g.DrawImage(ti.Image, rc); } } }
public void OnDragHotTrackEnded(SMTokenItem item, PVDragContext context) { if (Document != null) { scheduledScripts.Clear(); ExtractControlConnections(context.trackedControl, scheduledScripts, "OnDragHotTrackEnded"); ExecuteScheduledObjects(context.trackedControl); } }
public void OnDragMove(SMControl control, SMTokenItem token, PVDragContext context) { if (Document != null) { scheduledScripts.Clear(); ExtractControlConnections(control, scheduledScripts, "OnDragMove"); ExecuteScheduledObjects(control); } }
// control events public void OnDragFinished(SMControl control, SMTokenItem token, PVDragContext context) { // find all connections of type "partOfGroup" where target is control // and notify parent group that this event has occured // find all activities in graph that are target conected to this control as source and have // name of connection as this event // and execute them and then execute their successors if (Document != null) { scheduledScripts.Clear(); ExtractControlConnections(control, scheduledScripts, "OnDragFinished"); ExecuteScheduledObjects(control); } }