public ControlHost(ControlHost prototype) : base(prototype) { ctrlMouseAction = prototype.ctrlMouseAction; _control = null; if (prototype._control != null) { System.Type controlType = prototype._control.GetType(); if (controlType != null) { // Instantiate the control ConstructorInfo ctorInfo = controlType.GetConstructor(System.Type.EmptyTypes); _control = (System.Windows.Forms.Control)ctorInfo.Invoke(null); if (_control != null) _control.Visible = false; } } setExpandable(prototype.Expandable); setExpanded(prototype.Expanded); selStyle = prototype.selStyle; }
public ControlHostConfirmArgs(ControlHost host) { this.controlHost = host; this.point = new PointF(0, 0); this.handle = -1; confirm = true; }
public ControlHostConfirmArgs(ControlHost host, PointF point, int handle) { this.controlHost = host; this.point = point; this.handle = handle; confirm = true; }
public ControlHost(ControlHost prototype) : base(prototype) { ctrlMouseAction = prototype.ctrlMouseAction; _control = null; if (prototype._control != null) { System.Type controlType = prototype._control.GetType(); if (controlType != null) { // Instantiate the control ConstructorInfo ctorInfo = controlType.GetConstructor(System.Type.EmptyTypes); _control = (System.Windows.Forms.Control)ctorInfo.Invoke(null); if (_control != null) { _control.Visible = false; } } } setExpandable(prototype.Expandable); setExpanded(prototype.Expanded); selStyle = prototype.selStyle; }
public ControlPaintArgs(Graphics g, ControlHost host, RectangleF rect) : base(host) { this.graphics = g; this.rect = rect; this.handled = true; }
public ControlHostMouseArgs(ControlHost host, MouseButtons btn, float x, float y, PointF documentPos) : base(btn, x, y) { controlHost = host; this.documentPos = documentPos; mnpHandle = host.getHandleIdx(documentPos); }
public ControlHostMouseArgs(ControlHost host, float x, float y, int mnpHandle) : base(x, y, mnpHandle) { controlHost = host; }
public void Remove(ControlHost host) { List.Remove(host); }
public void Add(ControlHost host) { List.Add(host); }
internal void fireControlHostSerializing(ControlHost host, BinaryWriter writer) { // Consider user if (ControlHostSerializing != null) { MemoryStream stream = new MemoryStream(0); ControlHostSerializing(this, new ControlHostSerializeArgs(host, stream)); // Append the stream byte[] b = stream.GetBuffer(); writer.Write(b.Length); writer.Write(b); } else { // No user storage writer.Write((int)0); } }
public ControlHostEventArgs(ControlHost host) { controlHost = host; }
/// <summary> /// Creates a new ControlHost instance and adds it to the flowchart. /// </summary> /// <param name="x">Horizontal position of the ControlHost.</param> /// <param name="y">Vertical position of the ControlHost.</param> /// <param name="width">Width of the ControlHost.</param> /// <param name="height">Height of the ControlHost.</param> /// <returns>A reference to the new ControlHost.</returns> public ControlHost CreateControlHost(float x, float y, float width, float height) { ControlHost newHost = new ControlHost(this); newHost.setPos(x, y, width, height); newHost.updateControlPosition(); Add(newHost, SelectAfterCreate); return newHost; }
public void Insert(int i, ControlHost host) { List.Insert(i, host); }
public ControlHostLink(ControlHost host, Arrow arrow, bool incoming) : base(arrow, incoming) { this.host = host; }
internal bool paintControlHost(Graphics g, ControlHost host, RectangleF rect) { if (PaintControlHost != null) { ControlPaintArgs args = new ControlPaintArgs(g, host, rect); PaintControlHost(this, args); return args.Handled; } return false; }
public ControlHostSerializeArgs(ControlHost host, Stream stream) { this.host = host; this.stream = stream; }
private ItemsAndGroups copySelection( FlowChart doc, bool unconnectedArrows, bool copyGroups) { if (doc.Selection.Objects.Count == 0) return null; // determine which items and groups to copy ChartObjectCollection items = new ChartObjectCollection(); GroupCollection groups = new GroupCollection(); Hashtable indexMap = new Hashtable(); for (int i = 0; i < doc.Selection.Objects.Count; ++i) { ChartObject item = doc.Selection.Objects[i]; // do not copy unconncted arrows if specified if (!unconnectedArrows && item is Arrow) { Arrow arrow = item as Arrow; if (!arrow.IsConnected) continue; } indexMap[item] = items.Count; items.Add(item); if (copyGroups && item.SubordinateGroup != null) groups.Add(item.SubordinateGroup); } // add subordinated group items foreach (Group group in groups) { foreach (ChartObject item in group.AttachedObjects) { if (!items.Contains(item)) { indexMap[item] = items.Count; items.Add(item); } } } // copy nodes for (int i = 0; i < items.Count; ++i) { ChartObject item = items[i]; if (item is Box) items[i] = new Box((Box)item); if (item is ControlHost) items[i] = new ControlHost((ControlHost)item); if (item is Table) items[i] = new Table((Table)item); } // copy arrows, linking them to node clones for (int i = 0; i < items.Count; ++i) { if (items[i] is Arrow) { Arrow arrow = items[i] as Arrow; int srcIndex = indexMap.Contains(arrow.Origin) ? (int)indexMap[arrow.Origin] : -1; int dstIndex = indexMap.Contains(arrow.Destination) ? (int)indexMap[arrow.Destination] : -1; items[i] = new Arrow(arrow, srcIndex == -1 ? Dummy : items[srcIndex] as Node, dstIndex == -1 ? Dummy : items[dstIndex] as Node); } } // copy groups for (int i = 0; i < groups.Count; ++i) { Group group = new Group(groups[i]); groups[i] = group; group.setMainObject(items[(int)indexMap[group.MainObject]]); foreach (Attachment atc in group.Attachments) { atc.node = items[(int)indexMap[atc.node]] as Node; atc.node.putInGroup(group); } group.updateObjCol(); } return new ItemsAndGroups(items, groups); }
internal void fireControlHostDeleted(ControlHost host) { if (ControlHostDeleted != null) ControlHostDeleted(this, new ControlHostEventArgs(host)); }
internal void fireControlHostDeserializing(ControlHost host, BinaryReader reader) { int len = reader.ReadInt32(); if (len > 0) { byte[] buf = reader.ReadBytes(len); MemoryStream stream = new MemoryStream(buf, false); if (ControlHostDeserializing != null) ControlHostDeserializing(this, new ControlHostSerializeArgs(host, stream)); } }
public ControlHostSerializeArgs(ControlHost host, Stream stream) { this.host= host; this.stream = stream; }