Exemplo n.º 1
0
        private void GetBodySize(ref float W, ref float H, ref int RH, ref int ins, ref int outs)
        {
            Graphics gr = GraphicUtils.gr();

            Process c = m_node.ParentProcess.ParentProject.FindProcess(m_node.Subprocess);

            Font f = new Font("Arial", 10);

            if (c == null)
            {
                W = 30;
                H = 30;
                return;
            }

            ins = outs = 0;

            float inMaxW = 10, outMaxW = 10;

            foreach (Variable v in c.VarsList)
            {
                if (v.IsInput)
                {
                    ins++;
                    float w = gr.MeasureString(v.Name, f).Width;
                    if (w > inMaxW)
                    {
                        inMaxW = w;
                    }
                }
                if (v.IsOutput)
                {
                    outs++;
                    float w = gr.MeasureString(v.Name, f).Width;
                    if (w > outMaxW)
                    {
                        outMaxW = w;
                    }
                }
            }

            RH = (int)Math.Round(gr.MeasureString("qyZ", f).Height);

            int rows = Math.Max(ins, outs) + 1;

            H = 10 + rows * (RH + 10);

            float namew = gr.MeasureString(c.Name, f).Width;

            W = Math.Max(inMaxW + outMaxW + 10, namew + 30);
        }
Exemplo n.º 2
0
        public override Rectangle BoundingBox()
        {
            Graphics gr = GraphicUtils.gr();

            int W = 30;
            int H = 30;

            Rectangle r = new Rectangle(X - W / 2, Y - H / 2, W, H);

            Font  f = new Font("Arial", 10);
            SizeF m = gr.MeasureString(Name, f);

            r = Rectangle.Union(r, new Rectangle((int)(X - m.Width / 2), (int)(Y - H / 2 - m.Height - 2), (int)m.Width, (int)m.Height));

            return(r);
        }
Exemplo n.º 3
0
        public override Rectangle BoundingBox()
        {
            Graphics gr = GraphicUtils.gr();

            Font f = new Font("Arial", 10);

            float W = 0, H = 0;
            int   row_height = 0, ins = 0, outs = 0;

            GetBodySize(ref W, ref H, ref row_height, ref ins, ref outs);

            Rectangle r = new Rectangle((int)(X - W / 2), (int)(Y - H / 2), (int)W, (int)H);

            float nameWidth = gr.MeasureString(Name, f).Width;

            r = Rectangle.Union(r, new Rectangle((int)(X - nameWidth / 2), (int)(Y + H / 2 + 2), (int)nameWidth, (int)row_height));

            return(r);
        }
Exemplo n.º 4
0
 public override void AfterChange()
 {
     PortsRefresh(GraphicUtils.gr());
 }