public FlowConnector(FlowElement owner, string name, bool isInput) : this(owner, isInput) { this.Name = name; // Precalculate the invalidation width. this.InvalidationWidth = 200; }
public FlowConnector(FlowElement owner, bool isInput) { if (owner == null) { throw new ArgumentNullException("owner"); } this.Owner = owner; this.IsInput = isInput; }
internal static int GetConnectorIndex(FlowElement el, FlowConnector fl) { if (fl.IsInput) { return(el.InputConnectors.IndexOf(fl)); } else { return(el.OutputConnectors.IndexOf(fl)); } }
public ExportForm(Flow.FlowElement flowElement) { InitializeComponent(); LayerFlowElement lfw = flowElement as LayerFlowElement; this.m_Layer = lfw.Layer; if (this.m_Layer is Layer2D) { this.m_Bitmap = new Bitmap(1024, 1024); } else { this.m_Bitmap = new Bitmap(1024 + 32, 1024 + 256); } this.c_RenderBox.Image = this.m_Bitmap; this.c_Timer.Start(); }
internal static void RenderTo(FlowConnector el, RenderAttributes re) { re.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; re.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit; // If we are input, we draw on the left hand side of the flow element. int idx = FlowElement.GetConnectorIndex(el.Owner, el); int sx = (int)Math.Ceiling(re.Graphics.MeasureString(el.Name, re.Font).Width); float xx = (el.IsInput ? el.Owner.X - CONNECTOR_PADDING : el.Owner.X + el.Owner.Width + CONNECTOR_PADDING) * re.Zoom; float yy = (el.Owner.Y + idx * (CONNECTOR_SIZE + CONNECTOR_PADDING)) * re.Zoom; if (el.IsInput) { re.Graphics.DrawString(el.Name, re.Font, SystemBrushes.ControlText, new PointF(xx - sx + CONNECTOR_PADDING * re.Zoom, yy)); } else { re.Graphics.DrawString(el.Name, re.Font, SystemBrushes.ControlText, new PointF(xx, yy)); } el.InvalidationWidth = sx; el.m_CenterZoomAdjustment = re.Zoom; sx += CONNECTOR_PADDING; re.Graphics.DrawRectangle(Pens.Black, xx + (el.IsInput ? -sx : sx), yy, CONNECTOR_SIZE * re.Zoom, CONNECTOR_SIZE * re.Zoom); if (el.IsInput && el.ConnectedTo != null) { foreach (FlowConnector ct in el.ConnectedTo) { try { re.Graphics.DrawLine(Pens.Blue, el.Center.Apply(re.Zoom), ct.Center.Apply(re.Zoom)); } catch (OverflowException) { } } } }