public EditTernaryRelationship(RelationshipShape relationship)
        {
            InitializeComponent();

            Relationship    = new RelationshipShape(relationship.sName, new Point(panelDoubleBuffered1.Width / 2, panelDoubleBuffered1.Height / 2), relationship.type);
            SelectedEntity1 = new EntityShape(relationship.cardinalities[0].Entity.sName, new Point(panelDoubleBuffered1.Width / 2, ThongSo.ShapeH / 2), relationship.cardinalities[0].Entity.type);
            SelectedEntity2 = new EntityShape(relationship.cardinalities[1].Entity.sName, new Point(panelDoubleBuffered1.Width / 2 - ThongSo.ShapeW * 3 / 2, panelDoubleBuffered1.Height - ThongSo.ShapeH / 2), relationship.cardinalities[1].Entity.type);
            SelectedEntity3 = new EntityShape(relationship.cardinalities[2].Entity.sName, new Point(panelDoubleBuffered1.Width / 2 + ThongSo.ShapeW * 3 / 2, panelDoubleBuffered1.Height - ThongSo.ShapeH / 2), relationship.cardinalities[2].Entity.type);

            cardi1 = Relationship.CreateCardinality(SelectedEntity1, relationship.cardinalities[0].MinCardinality, relationship.cardinalities[0].MaxCardinality);
            cardi2 = Relationship.CreateCardinality(SelectedEntity2, relationship.cardinalities[1].MinCardinality, relationship.cardinalities[1].MaxCardinality);
            cardi3 = Relationship.CreateCardinality(SelectedEntity3, relationship.cardinalities[2].MinCardinality, relationship.cardinalities[2].MaxCardinality);

            panelDoubleBuffered1.Controls.Add(Relationship);
            panelDoubleBuffered1.Controls.Add(SelectedEntity1);
            panelDoubleBuffered1.Controls.Add(SelectedEntity2);
            panelDoubleBuffered1.Controls.Add(SelectedEntity3);
            panelDoubleBuffered1.Refresh();

            int min1, max1, min2, max2, min3, max3;

            min1 = Relationship.cardinalities[0].MinCardinality;
            max1 = Relationship.cardinalities[0].MaxCardinality;

            min2 = Relationship.cardinalities[1].MinCardinality;
            max2 = Relationship.cardinalities[1].MaxCardinality;

            min3 = Relationship.cardinalities[2].MinCardinality;
            max3 = Relationship.cardinalities[2].MaxCardinality;

            setCardinality(min1, max1, imageComboBoxEdit1);
            setCardinality(min2, max2, imageComboBoxEdit2);
            setCardinality(min3, max3, imageComboBoxEdit3);

            showText();
        }
Exemplo n.º 2
0
        public AddCardinality(RelationshipShape relationship)
        {
            InitializeComponent();

            Relationship    = new RelationshipShape(relationship.sName, new Point(panelDoubleBuffered1.Width / 2, panelDoubleBuffered1.Height / 2), relationship.type);
            SelectedEntity1 = new EntityShape(relationship.cardinalities[0].Entity.sName, new Point(panelDoubleBuffered1.Width / 2 - ThongSo.ShapeW * 3 / 2, panelDoubleBuffered1.Height / 2), relationship.cardinalities[0].Entity.type);
            SelectedEntity2 = new EntityShape(relationship.cardinalities[1].Entity.sName, new Point(panelDoubleBuffered1.Width / 2 + ThongSo.ShapeW * 3 / 2, panelDoubleBuffered1.Height / 2), relationship.cardinalities[1].Entity.type);

            cardi1 = Relationship.CreateCardinality(SelectedEntity1, relationship.cardinalities[0].MinCardinality, relationship.cardinalities[0].MaxCardinality);
            cardi2 = Relationship.CreateCardinality(SelectedEntity2, relationship.cardinalities[1].MinCardinality, relationship.cardinalities[1].MaxCardinality);

            panelDoubleBuffered1.Controls.Add(Relationship);
            panelDoubleBuffered1.Controls.Add(SelectedEntity1);
            panelDoubleBuffered1.Controls.Add(SelectedEntity2);
            panelDoubleBuffered1.Refresh();

            int min1, max1, min2, max2;

            min1 = Relationship.cardinalities[0].MinCardinality;
            max1 = Relationship.cardinalities[0].MaxCardinality;

            min2 = Relationship.cardinalities[1].MinCardinality;
            max2 = Relationship.cardinalities[1].MaxCardinality;

            if (min1 == 0 && max1 == 1)
            {
                imageComboBoxEdit1.SelectedIndex = 0;
            }
            if (min1 == 1 && max1 == 1)
            {
                imageComboBoxEdit1.SelectedIndex = 1;
            }
            if (min1 == 0 && max1 == -1)
            {
                imageComboBoxEdit1.SelectedIndex = 2;
            }
            if (min1 == 1 && max1 == -1)
            {
                imageComboBoxEdit1.SelectedIndex = 3;
            }

            if (min2 == 0 && max2 == 1)
            {
                imageComboBoxEdit2.SelectedIndex = 0;
            }
            if (min2 == 1 && max2 == 1)
            {
                imageComboBoxEdit2.SelectedIndex = 1;
            }
            if (min2 == 0 && max2 == -1)
            {
                imageComboBoxEdit2.SelectedIndex = 2;
            }
            if (min2 == 1 && max2 == -1)
            {
                imageComboBoxEdit2.SelectedIndex = 3;
            }


            showText();
        }