Esempio n. 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="theLabel">The arrow label</param>
        public ArrowPanel(IArrowLabel theLabel)
        {
            PictureBox box = new PictureBox();

            box.Left = 5;
            box.Top  = y + 5;
            Image im = NamedComponent.GetImage(theLabel);

            box.Width  = im.Width;
            box.Height = im.Height;
            box.Image  = im;
            Controls.Add(box);
            Label label = new Label();

            label.Top  = box.Top;
            label.Left = box.Left + box.Width + 5;
            label.Text = theLabel.RootName;            //NamedComponent.GetText(theLabel);
            Controls.Add(label);
            objects    = new IObjectLabel[2];
            objects[0] = theLabel.Source;
            objects[1] = theLabel.Target;
            y          = box.Top + box.Height;
            Name       = theLabel.RootName;      //NamedComponent.GetText(theLabel) + "";
            initialize();
        }
Esempio n. 2
0
        /// <summary>
        /// Initialization
        /// </summary>
        private void Initialize()
        {
            int ho = Height;
            int ph = pictureBoxObject.Height;

            try
            {
                Image im = NamedComponent.GetImage(theObject);
                pictureBoxObject.Width  = im.Width;
                pictureBoxObject.Height = im.Height;
                pictureBoxObject.Image  = im;
            }
            catch (Exception ex)
            {
                ex.ShowError(10);
            }
            if (theBase != null)
            {
                labelObject.Text = theBase.GetRelativeName(theObject);
            }
            else
            {
                labelObject.Text = theObject.RootName;
            }
            int dh = pictureBoxObject.Height - ph;

            panelTop.Height = panelTop.Height + dh;
            Height          = Height + dh;
        }
Esempio n. 3
0
 /// <summary>
 /// Initialization
 /// </summary>
 private void initialize()
 {
     Width  = 300;
     Height = 100;
     for (int i = 0; i < 2; i++)
     {
         Label label = new Label();
         label.Top  = y + 5;
         label.Left = 5;
         label.Text = texts[i];
         int yy = label.Top + label.Height;
         Controls.Add(label);
         PictureBox box = new PictureBox();
         Image      im  = NamedComponent.GetImage(objects[i]);
         box.Width  = im.Width;
         box.Height = im.Height;
         box.Left   = 5;
         box.Top    = yy + 5;
         box.Image  = im;
         Controls.Add(box);
         Label labelObj = new Label();
         labelObj.Top  = box.Top;
         labelObj.Left = box.Left + box.Width + 5;
         string text = objects[i].RootName;                //NamedComponent.GetText(objects[i]) + "";
         labelObj.Text = text;
         Controls.Add(labelObj);
         y = 5 + box.Top + box.Height;
     }
     Height = y;
 }
Esempio n. 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="operation">Operation</param>
        /// <param name="w">Width</param>
        public PanelUnary(IObjectOperation operation, int w)
        {
            Width          = w;
            this.operation = operation;
            ICategoryObject o = operation as ICategoryObject;

            label = o.Object as IObjectLabel;
            PictureBox p = new PictureBox();

            p.Image = NamedComponent.GetImage(label);
            int y = 10;
            int x = 10;

            p.Left = x;
            p.Top  = y;
            Controls.Add(p);
            y += p.Height + 10;
            Label lab = new Label();

            lab.Text = label.RootName;            //NamedComponent.GetText(label) + "";
            lab.Left = x;
            lab.Top  = y;
            Controls.Add(lab);
            y      += lab.Height + 10;
            cb.Top  = y;
            cb.Left = x;
            Controls.Add(cb);
            y     += cb.Height + 10;
            Height = y;
        }
Esempio n. 5
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="component">Corresponding component</param>
        public DefaultForm(INamedComponent component)
        {
            InitializeComponent();
            this.component = component;
            this.LoadControlResources(ControlUtilites.Resources);            //, Resources);
            UpdateFormUI();
            pictureBoxObject.Image = NamedComponent.GetImage(component);
            labelH.Text            = NamedComponent.GetToolTip(component);
            object o = null;

            if (component is IObjectLabel)
            {
                IObjectLabel l = component as IObjectLabel;
                o = l.Object;
            }
            if (component is IArrowLabel)
            {
                IArrowLabel l = component as IArrowLabel;
                o = l.Arrow;
            }
            if (!(o is IUpdatableObject))
            {
                checkBoxUpdatable.Visible = false;
            }
            else
            {
                IUpdatableObject upd = o as IUpdatableObject;
                if (upd.ShouldUpdate)
                {
                    checkBoxUpdatable.Checked = true;
                }
            }

            if (!(component is IArrowLabel))
            {
                this.labelSourceH.Visible = false;
                this.labelTargetH.Visible = false;
                return;
            }
            IArrowLabel label = component as IArrowLabel;

            pictureBoxSource.Image = NamedComponent.GetImage(label.Source);
            pictureBoxTarget.Image = NamedComponent.GetImage(label.Target);
        }
Esempio n. 6
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label">Arrow label</param>
        public FormAggregateLink(IArrowLabel label)
            : this()
        {
            this.label = label;
            UpdateFormUI();
            link = label.Arrow as MechanicalAggregateLink;
            try
            {
                pictureBoxParent.Image = NamedComponent.GetImage(label.Target);
                pictureBoxChild.Image  = NamedComponent.GetImage(label.Source);
            }
            catch (Exception ex)
            {
                ex.ShowError(10);
            }
            source = link.SourceObject;
            target = link.TargetObject;
            int nt = target.NumberOfConnections;
            int ns = source.NumberOfConnections;

            if (nt == 0)
            {
                numericUpDownChild.Enabled = false;
            }
            else
            {
                numericUpDownChild.Minimum = 1;
                numericUpDownChild.Maximum = source.NumberOfConnections;
                numericUpDownChild.Value   = link.SourceConnection + 1;
            }
            if (nt == 0)
            {
                numericUpDownParent.Enabled = false;
            }
            else
            {
                numericUpDownParent.Minimum = 1;
                numericUpDownParent.Maximum = target.NumberOfConnections;
                numericUpDownParent.Value   = link.TargetConnection + 1;
            }
            first = false;
        }
        void fill()
        {
            if (field == null)
            {
                return;
            }
            if (field.Field == null)
            {
                return;
            }
            Image im = NamedComponent.GetImage(field.Field as ICategoryObject);

            pictureBoxGrav.Image = im;
            string name =
                data.GetRelativeName(field.Field as ICategoryObject);

            labelName.Text = name;
            int[] n = field.Numbers;
            foreach (int i in n)
            {
                comboBoxNum.Items.Add(i + "");
            }
            int k = field.Number;

            if (k < 0)
            {
                return;
            }
            string sk = k + "";

            for (int i = 0; i < comboBoxNum.Items.Count; i++)
            {
                string s = comboBoxNum.Items[i] + "";
                if (s.Equals(sk))
                {
                    comboBoxNum.SelectedIndex = i;
                    break;
                }
            }
        }