コード例 #1
0
        /// <summary>
        /// Expands children
        /// </summary>
        public void Expand()
        {
            IObjectContainer cont = Object as IObjectContainer;

            cont.Load();
            cont.PostLoad();
            if (cont is ICategoryObject)
            {
                ICategoryObject ca = cont as ICategoryObject;
                ca.Object = this;
            }
            Dictionary <string, object> table = cont.Interface;

            foreach (string name in table.Keys)
            {
                INamedComponent  c = cont[name];
                object[]         o = table[name] as object[];
                ChildObjectLabel l = new ChildObjectLabel(this, name, c, o);
                inter.Add(l);
                ContainerPerformer.Children[c as IObjectLabel] = l;
            }
        }
コード例 #2
0
        /// <summary>
        /// The on mouse up event handler
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The event arguments</param>
        protected void onMouseUpArrow(object sender, MouseEventArgs e)
        {
            //isMoved = false;
            PanelDesktop   desktop = Parent as PanelDesktop;
            ICategoryArrow arrow   = desktop.ActiveArrow;

            if (!StaticExtensionDiagramUIForms.IsArrowClick(e))
            {
                return;
            }
            if (!(nc is IObjectLabel))
            {
                return;
            }
            IObjectLabel    ol  = nc as IObjectLabel;
            ICategoryObject obj = ol.Object;

            try
            {
                if (arrow == null)
                {
                    return;
                }
                int x = Left + e.X;
                int y = Top + e.Y;
                for (int i = 0; i < desktop.Controls.Count; i++)
                {
                    if (!(desktop.Controls[i] is ChildObjectLabel) & !(desktop.Controls[i] is ObjectLabel))
                    {
                        continue;
                    }
                    Control c = desktop.Controls[i];
                    bool    hor = x <c.Left | x> c.Left + c.Width;
                    bool    vert = y <c.Top | y> c.Top + c.Height;
                    if (hor | vert)
                    {
                        continue;
                    }
                    IObjectLabel label = null;
                    if (desktop.Controls[i] is IObjectLabel)
                    {
                        label = desktop.Controls[i] as IObjectLabel;
                    }
                    else
                    {
                        ChildObjectLabel child = desktop.Controls[i] as ChildObjectLabel;
                        label = child.Label;
                    }
                    arrow.Target = label.Object;
                    ArrowLabel lab =
                        desktop.Tools.Factory.CreateArrowLabel(desktop.Tools.Active,
                                                               arrow, ol, label) as ArrowLabel;
                    lab.Arrow.Object = lab;
                    desktop.AddArrowLabel(lab);
                    break;
                }
            }
            catch (Exception ex)
            {
                ex.ShowError(10);
                if (arrow != null)
                {
                    if (arrow is IRemovableObject)
                    {
                        IRemovableObject rem = arrow as IRemovableObject;
                        rem.RemoveObject();
                    }
                }
                ex.ShowError(1);
            }
            desktop.ActiveArrow = null;
            desktop.Redraw();
        }