public void SetGuiCoords()
        {
            GUICoordsEntity coords = this.tableEntity.GetCoords();

            coords.SetPosX(this.Bounds.X);
            coords.SetPosY(this.Bounds.Y);
            coords.SetWidth(this.Width);
            coords.SetHeight(this.Height);
        }
Exemplo n.º 2
0
        public void SetChildTable(TableControl te)
        {
            childTable = te;
            join.SetChildTable(te.GetTableEntity());
            lastChildX = te.Bounds.X + te.Width / 2;
            lastChildY = te.Bounds.Y + te.Height / 2;

            GUICoordsEntity coords = join.GetCoords();

            coords.SetPosX(this.Bounds.X);
            coords.SetPosY(this.Bounds.Y);
            coords.SetWidth(this.Width);
            coords.SetHeight(this.Height);
        }
Exemplo n.º 3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            GUICoordsEntity coords = join.GetCoords();

            coords.SetPosX(this.Bounds.X);
            coords.SetPosY(this.Bounds.Y);
            coords.SetWidth(this.Width);
            coords.SetHeight(this.Height);

            Graphics  g      = e.Graphics;
            Rectangle bounds = new Rectangle(0, 0, this.Width - 1, this.Height - 1);

            if (mainTable != null && childTable != null && IsObjectMoved(mainTable, childTable, thresholdX, thresholdY))
            {
                Parent.Invalidate(this.Bounds, true);
                g.FillRectangle(new SolidBrush(Color.FromArgb(255, this.BackColor)), bounds);
            }
            else
            {
                Pen pen;

                switch (joinType)
                {
                case Enums.JoinType.Left:
                {
                    pen           = new Pen(Color.LightBlue, 2);
                    pen.DashStyle = DashStyle.Dash;
                    break;
                }

                case Enums.JoinType.Right:
                {
                    pen           = new Pen(Color.LightGreen, 2);
                    pen.DashStyle = DashStyle.Dash;
                    break;
                }

                case Enums.JoinType.Inner:
                {
                    pen           = new Pen(Color.Red, 2);
                    pen.DashStyle = DashStyle.Dot;
                    break;
                }

                case Enums.JoinType.Full:
                {
                    pen           = new Pen(Color.Black, 2);
                    pen.DashStyle = DashStyle.Solid;
                    break;
                }

                default:
                {
                    pen = new Pen(Color.Black, 2);
                    break;
                }
                }

                AdjustableArrowCap bigArrow = new AdjustableArrowCap(7, 7);
                pen.CustomEndCap = bigArrow;

                int startX, startY, finalX, finalY, halfX, halfY;

                if (mainTable.Bounds == null || childTable.Bounds == null)
                {
                    mainTable.Bounds  = bounds;
                    childTable.Bounds = bounds;
                }

                startX = mainTable.Bounds.X + mainTable.Width / 2;
                startY = mainTable.Bounds.Y + mainTable.Height / 2;
                finalX = childTable.Bounds.X + childTable.Width / 2;
                finalY = childTable.Bounds.Y + childTable.Height / 2;
                halfX  = (finalX + startX) / 2;
                halfY  = (finalY + startY) / 2;

                g.DrawLine(pen, startX, startY, halfX, halfY);
                bigArrow         = new AdjustableArrowCap(1, 1);
                pen.CustomEndCap = bigArrow;
                g.DrawLine(pen, halfX, halfY, finalX, finalY);

                pen.Dispose();
            }


            g.Dispose();
            base.OnPaint(e);
        }