Esempio n. 1
0
        int IComparer.Compare(Object x, Object y)
        {
            RptSingleObj xObj = x as RptSingleObj;
            RptSingleObj yObj = y as RptSingleObj;

            return((new CaseInsensitiveComparer()).Compare(xObj.Location.Y, yObj.Location.Y));
        }
Esempio n. 2
0
 /// <summary>
 /// 在指定的位置插入一个报表
 /// </summary>
 /// <param name="pRptObj"></param>
 /// <param name="pLocation"></param>
 /// <returns></returns>
 public RptSingleObj InsertByLocation(RptSingleObj pRptObj, Point pLocation)
 {
     foreach (RptSingleObj obj in this)
     {
         if (obj.Location.X >= pLocation.X)
         {
             //在控件插入的指定位置的左边不需要调整,右边调整各个控件的位置
             obj.Location = new Point(obj.Location.X + pRptObj.Size.Width, obj.Location.Y);
         }
     }
     this.Add(pRptObj);
     return(pRptObj);
 }
Esempio n. 3
0
        /// <summary>
        /// 自动调整Section 中各控件(主要针对网格控件打印的情况,而且是单表头的情况,其它时候不需要使用)
        /// 如果打印内容的最右边小于报表的宽度,那么不需要调整。
        /// </summary>
        public void AutoFitSizeWidth()
        {
            int maxRight     = GetMaxCtlRight();
            int sectionWidth = _Section.Width;
            int ctlCount     = this.Count;

            //先让控件从左到右排列
            this.Sort(new RptObjSortComparer());
            if (maxRight > sectionWidth)
            {
                int setWidth = maxRight - sectionWidth;
                int moveSize = 0;
                for (int i = 0; i < ctlCount; i++)
                {
                    RptSingleObj obj = this[i] as RptSingleObj;
                    obj.Location = new Point(obj.Location.X - moveSize, obj.Location.Y);
                    int sm = System.Convert.ToInt32(obj.Size.Width * setWidth / maxRight);
                    moveSize += sm;
                    obj.Size  = new Size(obj.Size.Width - sm, obj.Size.Height);
                }
            }
        }