Example #1
0
        public int Add(Label value)
        {
            //value.SetRuntimeHeight(value.Caption );
            value.KeepPos = true;
            AddArgs e = new AddArgs();

            if (BeforeAdd != null)
            {
                BeforeAdd(value, e);
            }
            if (!e.bAlreadyAdd)
            {
                for (int i = 0; i < Count; i++)
                {
                    if (value.X < this[i].X)
                    {
                        return(Insert(i, value));
                    }
                }
                return(List.Add(value));
            }
            else
            {
                return(-1);
            }
        }
Example #2
0
        private void _labels_BeforeAdd(object sender, EventArgs e)
        {
            Label   label = sender as Label;
            AddArgs aa    = e as AddArgs;
            int     i     = 0;

            while (i < _labels.Count)
            {
                Label lab = _labels[i];
                if (label.bUnder(lab) && lab is SuperLabel)
                {
                    if (label.LabelType != LabelType.DetailLabel)
                    {
                        (lab as SuperLabel).LabelType = label.LabelType;
                    }
                    (lab as SuperLabel).Labels.Add(label);
                    aa.bAlreadyAdd = true;
                    i++;
//					return;
                }
                else if (lab.bUnder(label) && label is SuperLabel)
                {
                    if (lab.LabelType != LabelType.DetailLabel)
                    {
                        (label  as SuperLabel).LabelType = lab.LabelType;
                    }
                    (label as SuperLabel).Labels.Add(lab);
                    _labels.Remove(lab);
                }
                else
                {
                    i++;
                }
            }
        }
Example #3
0
        private void _cells_BeforeAdd(object sender, EventArgs e)
        {
            Cell    cell = sender as Cell;
            AddArgs aa   = e as AddArgs;

            if (cell.Parent != null)
            {
                if (cell.Parent != this)
                {
                    cell.Parent.Cells.Remove(cell);
                    cell.Parent    = this;
                    cell.RelativeY = cell.Y - _y;
                }
                else if (cell.Parent.Cells.Contains(cell))
                {
                    aa.bAlreadyAdd = true;
                }
            }
            else
            {
                cell.Parent    = this;
                cell.RelativeY = cell.Y - _y;
            }
            //cell.GetReport();
            //if (cell.Report != null && !cell.Report.bFree)
            //{
            if (cell is IApplyColorStyle)
            {
                if ((cell as IApplyColorStyle).bApplyColorStyle)
                {
                    CopySectionStyleToCell(cell);
                }
            }
            else if ((cell.Type == "Label" || cell.Type == "SuperLabel") && this is IAlternativeStyle)
            {
                CopySectionStyleToLabel(cell);
            }
            else if (_sectiontype != SectionType.ReportHeader || cell.Type == "Label")
            {
                CopySectionStyleToCell(cell);
            }

            //}
        }
Example #4
0
        public int Add(Cell value)
        {
            if (value.Width < 2)
            {
                return(-1);
            }
            value.UnderState = _understate;
            if (value.X < _x)
            {
                _x = value.X;
            }
            if (value.X + value.Width > _right)
            {
                _right = value.X + value.Width;
            }
            if (value.Y < _y)
            {
                _y = value.Y;
            }

            //if (_understate == ReportStates.Designtime)
            //{
            //    if (value.Y + value.Height  > _bottom)
            //        _bottom = value.Y + value.Height;
            //}
            //else
            //{
            if (value.Y + value.MetaHeight > _bottom)
            {
                _bottom = value.Y + value.MetaHeight;
            }
            if (value.Y + value.ExpandHeight > _expandbottom)
            {
                _expandbottom = value.Y + value.ExpandHeight;
            }
            //}

            //---------------------
            //int height;
            //if (_understate != ReportStates.Designtime)
            //    height=value.MetaHeight;
            //else
            //    height=value.Height;
            //if(value.Y+height  >_bottom)
            //    _bottom=value.Y+height ;
            //----------------------
            AddArgs aa = new AddArgs();

            if (BeforeAdd != null)
            {
                BeforeAdd(value, aa);
            }
            if (aa.bAlreadyAdd)
            {
                return(-1);
            }
            //if (_understate != ReportStates.Designtime)
            //{
            for (int i = 0; i < Count; i++)
            {
                Cell c = this[i];
                if (value.X < c.X)
                {
                    Insert(i, value);
                    return(i);
                }
                else if (value.X == c.X)
                {
                    if (value.Y <= c.Y)
                    {
                        Insert(i, value);
                        return(i);
                    }
                }
            }
            //}
            //else
            //{
            //    for(int i=0;i<Count;i++)
            //    {
            //        if(value.Z_Order < this[i].Z_Order )
            //        {
            //            Insert(i,value);
            //            return i;
            //        }
            //    }
            //}
            return(List.Add(value));
        }