示例#1
0
文件: TableEx.cs 项目: zanderzhg/Sc
        public PointF TransToGlobalPoint(PointF pt)
        {
            RectangleF rect;
            float      x = pt.X, y = pt.Y;
            CellCoord  inCellCoord = inParentCellCoord;

            x += tbPos.X;
            y += tbPos.Y;

            for (TableEx tb = parentTable; tb != null; tb = tb.parentTable)
            {
                rect        = tb.GetCellContentRect(inCellCoord.rowIdx, inCellCoord.colIdx);
                x          += rect.X + tb.tbPos.X;
                y          += rect.Y + tb.tbPos.Y;
                inCellCoord = tb.inParentCellCoord;
            }

            return(new PointF(x, y));
        }
示例#2
0
文件: TableEx.cs 项目: zanderzhg/Sc
        public RectangleF TransToGlobalRect(RectangleF rect)
        {
            RectangleF r;
            CellCoord  inCellCoord = inParentCellCoord;
            float      x = rect.X, y = rect.Y;

            x += tbPos.X;
            y += tbPos.Y;

            for (TableEx tb = parentTable; tb != null; tb = tb.parentTable)
            {
                r           = tb.GetCellContentRect(inCellCoord.rowIdx, inCellCoord.colIdx);
                x          += r.X + tb.tbPos.X;
                y          += r.Y + tb.tbPos.Y;
                inCellCoord = tb.inParentCellCoord;
            }

            RectangleF dstRect = new RectangleF(x, y, rect.Width, rect.Height);

            return(dstRect);
        }
示例#3
0
文件: TableEx.cs 项目: zanderzhg/Sc
        void ModifyTableDockPos(TableDockType dockType)
        {
            RectangleF rect = new RectangleF(tbPos.X, tbPos.Y, tbWidth, tbHeight);

            if (parentTable != null)
            {
                rect = parentTable.GetCellContentRect(inParentCellCoord.rowIdx, inParentCellCoord.colIdx);
            }

            switch (tableSizeType)
            {
            case TableSizeType.Fill:
                tbHeight = rect.Height;
                tbWidth  = rect.Width;
                break;

            case TableSizeType.HorizontalFill:
                tbWidth = rect.Width;
                break;

            case TableSizeType.VerticalFill:
                tbHeight = rect.Height;
                break;
            }

            switch (dockType)
            {
            case TableDockType.Center:
                tbPos.X = rect.Width / 2 - tbWidth / 2;
                tbPos.Y = rect.Height / 2 - tbHeight / 2;
                return;

            case TableDockType.Left:
                tbPos.X = 0;
                tbPos.Y = rect.Height / 2 - tbHeight / 2;
                return;

            case TableDockType.LeftTop:
                tbPos.X = 0;
                tbPos.Y = 0;
                return;

            case TableDockType.Top:
                tbPos.X = rect.Width / 2 - tbWidth / 2;
                tbPos.Y = 0;
                return;

            case TableDockType.RightTop:
                tbPos.X = rect.Width - tbWidth;
                tbPos.Y = 0;
                return;

            case TableDockType.Right:
                tbPos.X = rect.Width - tbWidth;
                tbPos.Y = rect.Height / 2 - tbHeight / 2;
                return;

            case TableDockType.RightBottom:
                tbPos.X = rect.Width - tbWidth;
                tbPos.Y = rect.Height - tbHeight;
                return;

            case TableDockType.Bottom:
                tbPos.X = rect.Width / 2 - tbWidth / 2;
                tbPos.Y = rect.Height - tbHeight;
                return;

            case TableDockType.LeftBottom:
                tbPos.X = 0;
                tbPos.Y = rect.Height - tbHeight;
                return;
            }
        }