예제 #1
0
        public LinkGraphic[] GetChildLinks()
        {
            LinkGraphic[] ret = new LinkGraphic[lcmap.Count];
            int           ct  = 0;

            foreach (LinkGraphic lg in lcmap.Values)
            {
                ret[ct++] = lg;
            }
            return(ret);
        }
예제 #2
0
        private void childs_ItemsChanged(GraphItems sender, GraphItemChangedEventArgs e)
        {
            if (e.Added && sender.Count == 1)
            {
                Refresh();
            }
            if (e.Removed && sender.Count == 0)
            {
                Refresh();
            }

            if (e.Added)
            {
                LinkGraphic lc = new LinkGraphic();
                lc.Text            = e.Text;
                lc.ForeColor       = this.CurrentLinkColor;
                lc.Parent          = (GraphPanel)Parent;
                lc.StartElement    = this;
                lc.EndElement      = e.GraphItem;
                lc.StartAnchorSnap = LinkControlSnapAnchor.OnlyCenter;
                lc.EndAnchorSnap   = LinkControlSnapAnchor.OnlyCenter;
                lc.LineMode        = this.LineMode;
                lc.Quality         = this.Quality;


                lc.SendToBack();
                lcmap.Add(e.GraphItem, lc);
            }

            if (e.Removed)
            {
                LinkGraphic lc = (LinkGraphic)lcmap[e.GraphItem];
                if (lc != null)
                {
                    lcmap.Remove(lc);
                    lc.Parent = null;
                    lc.Dispose();
                }
            }
            if (e.Internal)
            {
                return;
            }
            if (e.Added)
            {
                e.GraphItem.ParentItems.SilentAdd(this, e.Text, true);
            }
            if (e.Removed)
            {
                e.GraphItem.ParentItems.SilentRemove(this, true);
            }
        }
예제 #3
0
 protected void SetChildLinkColor(GraphItemBase sender, Color cl)
 {
     foreach (GraphItemBase lg in this.childs)
     {
         if (lg == sender)
         {
             LinkGraphic lc = (LinkGraphic)lcmap[lg];
             if (lc != null)
             {
                 lc.ForeColor = cl;
             }
         }
     }
 }
예제 #4
0
 protected void SendAllChildLinksToFront(GraphItemBase sender)
 {
     foreach (GraphItemBase lg in this.childs)
     {
         if (lg == sender)
         {
             LinkGraphic lc = (LinkGraphic)lcmap[lg];
             if (lc != null)
             {
                 lc.SendToFront();
             }
         }
     }
 }
예제 #5
0
        protected override void DrawText(Graphics gr)
        {
            if (this.properties == null)
            {
                return;
            }
            LinkGraphic.SetGraphicsMode(gr, !Quality);

            Pen linepen = new Pen(Color.FromArgb(90, Color.Black));

            gr.DrawLine(linepen, new Point(0, 20), new Point(Width, 20));
            linepen.Dispose();

            StringFormat sf = new StringFormat();

            sf.FormatFlags = StringFormatFlags.NoWrap;
            Font ftb = new Font(Font.FontFamily, Font.Size, FontStyle.Bold, Font.Unit);

            gr.DrawString(Text, ftb, new Pen(this.ForeColor).Brush, new RectangleF(new PointF(4, 4), new SizeF(Width - 8, Height - 8)), sf);
            ftb.Dispose();
            int  top    = 24;
            Size indent = new Size(0, 0);

            if (thumb != null)
            {
                gr.DrawImageUnscaled(thumb, 4, top, thumb.Width, thumb.Height);
                indent = new Size(thumb.Width + 4, top + thumb.Height + 4);
            }

            //Hashtable ht = new Hashtable();
            foreach (string k in properties.Keys)
            {
                PropertyItem o = properties[k];
                if (o == null)
                {
                    continue;
                }
                string val = "";
                val = (string)o.Value;

                if (val != null)
                {
                    int indentx = 0;
                    if (top < indent.Height)
                    {
                        indentx = indent.Width;
                    }
                    Font ft = new Font(Font.FontFamily, Font.Size, FontStyle.Italic, Font.Unit);


                    gr.DrawString(
                        k + ":",
                        ft,
                        new Pen(Color.FromArgb(160, this.ForeColor)).Brush,
                        new RectangleF(new PointF(indentx + 10, top), new SizeF(Width - (24 + indentx), top + 16)),
                        sf);
                    SizeF sz = gr.MeasureString(
                        k + ":",
                        ft);

                    gr.DrawString(
                        val,
                        Font,
                        new Pen(Color.FromArgb(140, this.ForeColor)).Brush,
                        new RectangleF(new PointF(indentx + 12 + sz.Width, top), new SizeF(Width - (24 + sz.Width + indentx), top + 16)),
                        sf);
                    SizeF sz2 = gr.MeasureString(
                        val,
                        Font);

                    Rectangle rect = new Rectangle(new Point((int)(indentx + 12 + sz.Width), top), new Size((int)(Width - (24 + sz.Width + indentx)), top + 16));

                    top += (int)Math.Max(sz.Height, sz2.Height);
                    ft.Dispose();
                }
            }

            //LinkGraphic.SetGraphicsMode(gr, true);
            //properties = ht;
        }
예제 #6
0
        protected void DrawText(Graphics gr, Rectangle prec, Rectangle trec)
        {
            if (this.properties == null)
            {
                return;
            }
            LinkGraphic.SetGraphicsMode(gr, !Quality);

            Font ftb = new Font(Font.FontFamily, Font.Size, FontStyle.Bold, Font.Unit);

            this.DrawCaption(gr, new Rectangle(trec.Right + 2, prec.Top, prec.Width - (trec.Right - prec.Left) - 4 - this.ImageBorderWidth, 16), ftb, false);
            Pen linepen = new Pen(Color.FromArgb(90, Color.Black));

            gr.DrawLine(linepen, new Point(prec.Left, prec.Top + 16), new Point(prec.Right, prec.Top + 16));
            linepen.Dispose();


            StringFormat sf = new StringFormat();

            sf.FormatFlags = StringFormatFlags.NoWrap;
            int  top    = prec.Top + 24;
            Size indent = new Size(trec.Right + 6, trec.Bottom - prec.Top + 7 + 2 * this.ImageBorderWidth);

            //Hashtable ht = new Hashtable();
            foreach (string k in properties.Keys)
            {
                PropertyItem o = properties[k];
                if (o == null)
                {
                    continue;
                }
                string val = "";
                val = (string)o.Value;

                if (val != null)
                {
                    int indentx = prec.Left + 6;
                    if (top < indent.Height)
                    {
                        indentx = indent.Width;
                    }
                    Font ft = new Font(Font.FontFamily, Font.Size, FontStyle.Italic, Font.Unit);


                    gr.DrawString(
                        k + ":",
                        ft,
                        new Pen(Color.FromArgb(160, this.ForeColor)).Brush,
                        new RectangleF(new PointF(indentx, top), new SizeF(prec.Width - indentx, top + 16)),
                        sf);
                    SizeF sz = gr.MeasureString(
                        k + ":",
                        ft);

                    gr.DrawString(
                        val,
                        Font,
                        new Pen(Color.FromArgb(140, this.ForeColor)).Brush,
                        new RectangleF(new PointF(indentx + sz.Width, top), new SizeF(prec.Width - indentx - sz.Width, top + 16)),
                        sf);
                    SizeF sz2 = gr.MeasureString(
                        val,
                        Font);

                    Rectangle rect = new Rectangle(new Point((int)(indentx + sz.Width), top), new Size((int)(prec.Width - indentx - sz.Width), top + 16));

                    top += (int)Math.Max(sz.Height, sz2.Height);
                    ft.Dispose();
                }
            }

            //LinkGraphic.SetGraphicsMode(gr, true);
            //properties = ht;
        }