Esempio n. 1
0
        protected void UpdateLabelWidths()
        {
            ControlCollection coll = panelControls.Controls;

            int maxWidth = 0;

            int count = coll.Count;

            List <ControlThingVariable> vars = new List <ControlThingVariable>();

            for (int i = 0; i < count; ++i)
            {
                ControlThingVariable c = coll[i] as ControlThingVariable;

                if (c != null)
                {
                    vars.Add(c);

                    if (maxWidth < c.LabelWidth)
                    {
                        maxWidth = c.LabelWidth;
                    }
                }
            }

            // Apply max width.

            foreach (ControlThingVariable var in vars)
            {
                var.LabelWidth = maxWidth;
            }
        }
Esempio n. 2
0
        protected void AddElement(TNG.Element element)
        {
            ControlTNGElement c = null;

            if (element.GetType() == typeof(TNG.Variable))
            {
                c =
                    new ControlThingVariable((TNG.Variable)element);
            }
            else if (element.GetType() == typeof(TNG.ElementArray))
            {
                ControlElementArray c1 = new ControlElementArray();

                c1.Setup((TNG.ElementArray)element);

                // Add the expand/collapse/add/remove listener.
                c1.ControlsUpdated +=
                    new ControlsUpdatedHandler(array_ControlsUpdated);

                c = c1;
            }
            else
            {
                ControlComplexBlock c1 = new ControlComplexBlock();

                c1.Setup((TNG.ComplexBlock)element);

                // Add the expand/collapse/add/remove listener.
                c1.ControlsUpdated +=
                    new ControlsUpdatedHandler(array_ControlsUpdated);

                c = c1;
            }

            panelControls.Controls.Add(c);

            c.Dock = DockStyle.Top;
            c.BringToFront();

            c = null;
        }