Exemple #1
0
        private void DrawBorder(PageItem pi, Graphics g, RectangleF r)
        {
            if (r.Height <= 0 || r.Width <= 0)      // no bounding box to use
            {
                return;
            }

            StyleInfo si = pi.SI;

            DrawLine(si.BColorTop, si.BStyleTop, si.BWidthTop, g, r.X, r.Y, r.Right, r.Y);

            DrawLine(si.BColorRight, si.BStyleRight, si.BWidthRight, g, r.Right, r.Y, r.Right, r.Bottom);

            DrawLine(si.BColorLeft, si.BStyleLeft, si.BWidthLeft, g, r.X, r.Y, r.X, r.Bottom);

            DrawLine(si.BColorBottom, si.BStyleBottom, si.BWidthBottom, g, r.X, r.Bottom, r.Right, r.Bottom);

            return;
        }
        private void AddObjectInternal(PageItem pi)
        {
            pi.Page       = this;
            pi.ItemNumber = _items.Count;
            if (_items.Count == 0)
            {
                _lastZIndex = pi.ZIndex;
            }
            else if (_lastZIndex != pi.ZIndex)
            {
                _needSort = true;
            }

            // adjust the page item locations
            pi.X += _xOffset;
            pi.Y += _yOffset;
            if (pi is PageLine)
            {
                PageLine pl = pi as PageLine;
                pl.X2 += _xOffset;
                pl.Y2 += _yOffset;
            }
            else if (pi is PagePolygon)
            {
                PagePolygon pp = pi as PagePolygon;
                for (int i = 0; i < pp.Points.Length; i++)
                {
                    pp.Points[i].X += _xOffset;
                    pp.Points[i].Y += _yOffset;
                }
            }
            else if (pi is PageCurve)
            {
                PageCurve pc = pi as PageCurve;
                for (int i = 0; i < pc.Points.Length; i++)
                {
                    pc.Points[i].X += _xOffset;
                    pc.Points[i].Y += _yOffset;
                }
            }
        }
Exemple #3
0
        internal void SetPagePositionAndStyle(Report rpt, PageItem pi, Row row)
        {
            WorkClass wc = GetWC(rpt);

            pi.X = GetOffsetCalc(rpt) + LeftCalc(rpt);
            if (this._TC != null)
            {                   // must be part of a table
                Table t        = _TC.OwnerTable;
                int   colindex = _TC.ColIndex;

                // Calculate width: add up all columns within the column span
                float       width = 0;
                TableColumn tc;
                for (int ci = colindex; ci < colindex + _TC.ColSpan; ci++)
                {
                    tc     = (TableColumn)(t.TableColumns.Items[ci]);
                    width += tc.Width.ToPoints();
                }
                pi.W = width;
                pi.Y = 0;

                TableRow tr = (TableRow)(_TC.Parent.Parent);
                pi.H = tr.HeightCalc(rpt);                      // this is a cached item; note tr.HeightOfRow must already be called on row
            }
            else if (wc.MC != null)
            {                   // must be part of a matrix
                pi.W = wc.MC.Width;
                pi.Y = 0;
                pi.H = wc.MC.Height;
            }
            else if (pi is PageLine)
            {   // don't really handle if line is part of table???  TODO
                PageLine pl = (PageLine)pi;
                if (Top != null)
                {
                    pl.Y = this.Gap(rpt);                //  y will get adjusted when pageitem added to page
                }
                float y2 = pl.Y;
                if (Height != null)
                {
                    y2 += Height.ToPoints();
                }
                pl.Y2 = y2;
                pl.X2 = pl.X;
                if (Width != null)
                {
                    pl.X2 += Width.ToPoints();
                }
            }
            else
            {   // not part of a table or matrix
                if (Top != null)
                {
                    pi.Y = this.Gap(rpt);                //  y will get adjusted when pageitem added to page
                }
                if (Height != null)
                {
                    pi.H = Height.ToPoints();
                }
                else
                {
                    pi.H = this.HeightOrOwnerHeight;
                }
                if (Width != null)
                {
                    pi.W = Width.ToPoints();
                }
                else
                {
                    pi.W = this.WidthOrOwnerWidth(rpt);
                }
            }
            if (Style != null)
            {
                pi.SI = Style.GetStyleInfo(rpt, row);
            }
            else
            {
                pi.SI = new StyleInfo();    // this will just default everything
            }
            pi.ZIndex = this.ZIndex;        // retain the zindex of the object

            // Catch any action needed
            if (this._Action != null)
            {
                pi.BookmarkLink = _Action.BookmarkLinkValue(rpt, row);
                pi.HyperLink    = _Action.HyperLinkValue(rpt, row);
            }

            if (this._Bookmark != null)
            {
                pi.Bookmark = _Bookmark.EvaluateString(rpt, row);
            }

            if (this._ToolTip != null)
            {
                pi.Tooltip = _ToolTip.EvaluateString(rpt, row);
            }
        }
 public void AddObject(PageItem pi)
 {
     AddObjectInternal(pi);
     _items.Add(pi);
 }
 public void InsertObject(PageItem pi)
 {
     AddObjectInternal(pi);
     _items.Insert(0, pi);
 }