/// <summary>
        /// 在指定的位置报表打印和浏览需要的控件
        /// </summary>
        /// <param name="pType"></param>
        /// <param name="pObjList"></param>
        /// <param name="pLocation"></param>
        /// <param name="CtlWidth"></param>
        /// <param name="pColCount"></param>
        public void CreateRptObjByList(DIYReport.ReportModel.RptObjType pType, IList pObjList, Point pLocation,
                                       Size pCtlSize, int pColCount)
        {
            int hasCreate = 0;
            int rowCount  = 0;

            foreach (string sizeName in pObjList)
            {
                Point firstP;
                Point lastP;
                if (hasCreate > pColCount)
                {
                    hasCreate = 0;
                    rowCount++;
                }
                //计算动态创建控件的两个点
                firstP = new Point(pLocation.X + hasCreate * pCtlSize.Width, pLocation.Y + rowCount * pCtlSize.Height);
                int lastY = pLocation.Y + (rowCount + 1) * pCtlSize.Height;
                //如果Section 的高度不够,需要重新分配
                if (lastY > _Section.DataObj.Height)
                {
                    //暂时先不处理自动调整Section 的高度
                    //_Section.DataObj.Height = lastY;
                }
                int lastX = pLocation.X + (hasCreate + 1) * pCtlSize.Width;
                lastX = lastX > 0?lastX + 1:lastX;
                lastY = lastY > 0?lastY + 1:lastY;
                lastP = new Point(lastX, lastY);
                CreateControl(sizeName, false, DIYReport.ReportModel.RptObjType.Text, firstP, lastP);
                hasCreate++;
            }
            ShowFocusHandle(true);
        }
Exemple #2
0
        /// <summary>
        /// 根据类型创建报表对象。
        /// </summary>
        /// <param name="name"></param>
        /// <param name="dispText"></param>
        /// <returns></returns>
        public static DIYReport.Interface.IRptSingleObj CreateObj(DIYReport.ReportModel.RptObjType pType, string dispText)
        {
            DIYReport.Interface.IRptSingleObj obj = null;
            switch (pType)
            {
            case DIYReport.ReportModel.RptObjType.Line:
                obj = new DIYReport.ReportModel.RptObj.RptLine(null);
                break;

            case DIYReport.ReportModel.RptObjType.Rect:
                obj = new DIYReport.ReportModel.RptObj.RptRect(null);
                break;

            case DIYReport.ReportModel.RptObjType.Text:
                obj = new DIYReport.ReportModel.RptObj.RptLable(null, dispText);
                break;

            case DIYReport.ReportModel.RptObjType.Express:
                obj = new DIYReport.ReportModel.RptObj.RptExpressBox(null, dispText);
                break;

            case DIYReport.ReportModel.RptObjType.Image:
                obj = new DIYReport.ReportModel.RptObj.RptPictureBox(null);
                break;

            case DIYReport.ReportModel.RptObjType.FieldImage:
                obj = new DIYReport.ReportModel.RptObj.RptDBPictureBox(null);
                break;

            case DIYReport.ReportModel.RptObjType.CheckBox:
                obj = new DIYReport.ReportModel.RptObj.RptCheckBox(null);
                break;

            case DIYReport.ReportModel.RptObjType.BarCode:
                obj = new DIYReport.ReportModel.RptObj.RptBarCode(null);
                break;

            case DIYReport.ReportModel.RptObjType.SubReport:
                obj = new DIYReport.ReportModel.RptObj.RptSubReport(null);
                break;

            case DIYReport.ReportModel.RptObjType.FieldTextBox:
                obj = new DIYReport.ReportModel.RptObj.RptFieldTextBox(null);
                break;

            case DIYReport.ReportModel.RptObjType.HViewSpecField:
                obj = new DIYReport.ReportModel.RptObj.RptHViewSpecFieldBox(null);
                break;

            case DIYReport.ReportModel.RptObjType.RichTextBox:
                obj = new DIYReport.ReportModel.RptObj.RptRichTextBox(null);
                break;

            default:
                Debug.Assert(false, "该控件类型目前还没有处理!", "");
                return(null);
            }
            return(obj);
        }
Exemple #3
0
        public RptSingleObj(string pName, DIYReport.ReportModel.RptObjType pType)
        {
            _Name            = pName;
            _Type            = pType;
            _ForeColor       = Color.Black;
            _BackgroundColor = Color.White;

            _Location = new Point(0, 0);
            Size      = new Size(100, 25);
        }
Exemple #4
0
        public IRptSingleObj AddByType(DIYReport.ReportModel.RptObjType pType, string pDispText, DIYReport.ReportModel.RptSection pSection)
        {
            DIYReport.Interface.IRptSingleObj obj = DIYReport.RptObjectHelper.CreateObj(pType, pDispText);
            if (obj == null)
            {
                return(null);
            }

            obj.Name    = getObjNewName(obj.GetType().Name);
            obj.Section = pSection;
            base.Add(obj);
            return(obj);
        }
        public void CreateControl(string pDispText, bool pChangeRect, DIYReport.ReportModel.RptObjType pType, Point pFirst, Point pLast)
        {
            Rectangle rect = PublicFun.ChangeMousePointToRect(pFirst, pLast);

            Rectangle mousRect = pChangeRect?_Section.RectangleToClient(rect):rect;

            DIYReport.Interface.IRptSingleObj data = _DataObj.AddByType(pType, pDispText, _Section.DataObj);
            if (data == null)
            {
                return;
            }

            DesignControl ctl = new DesignControl(data);

            ctl.BringToFront();

            data.BeginUpdate();
            data.Location = new Point(mousRect.Left, mousRect.Top);
            data.Size     = mousRect.Size;
            data.EndUpdate();

            ctl.IsSelected     = true;
            ctl.IsMainSelected = true;
            this.Add(ctl);
            //判断是否通过鼠标来创建
            if (pChangeRect)
            {
                //ArrayList unList = new ArrayList();
                //object cUnData = data.Clone();
                //DIYReport.TrackEx.Write(cUnData!=null,"由于程序特殊的需要,该报表对象需要提供Clone() 的方法。");
                //if(cUnData!=null){
                //    unList.Add(cUnData);
                //    _UndoMgr.Store("新建报表控件",unList,this,DIYReport.UndoManager.ActionType.Add);
                //}
            }
            DesignEnviroment.CurrentRptObj = data;
        }
        private void createRptObj(DIYReport.ReportModel.RptSection pSection, XmlNodeList pSectionList)
        {
            foreach (XmlNode node in pSectionList)
            {
                DIYReport.ReportModel.RptSingleObj obj = new DIYReport.ReportModel.RptSingleObj();
                int objType = PublicFun.ToInt(node.Attributes["Type"].Value);
                DIYReport.ReportModel.RptObjType type = (DIYReport.ReportModel.RptObjType)objType;
                string objName = node.Attributes["Name"].Value;
                DIYReport.Interface.IRptSingleObj singObj = RptObjectHelper.CreateObj(type);
//				switch(type){
//					case DIYReport.ReportModel.RptObjType.Line:
//						singObj = new DIYReport.ReportModel.RptObj.RptLine(objName);
//						break;
//					case DIYReport.ReportModel.RptObjType.Rect:
//						singObj = new DIYReport.ReportModel.RptObj.RptRect(objName);
//						break;
//					case DIYReport.ReportModel.RptObjType.Text:
//						singObj = new DIYReport.ReportModel.RptObj.RptLable(objName);
//						break;
//					case DIYReport.ReportModel.RptObjType.Express:
//						singObj = new DIYReport.ReportModel.RptObj.RptExpressBox(objName);
//						break;
//					case DIYReport.ReportModel.RptObjType.Image:
//						singObj = new DIYReport.ReportModel.RptObj.RptPictureBox(objName);
//						break;
//
//					default:
//						Debug.Assert("该对象类型" + type.ToString() + "目前还没有处理.");
//						break;
//				}
                fillInfoToRptObj(singObj, node);
                singObj.Section = pSection;
                //把控件增加到Section 中
                pSection.RptObjList.Add(singObj);
            }
        }
 /// <summary>
 /// 通过鼠标创建控件
 /// </summary>
 /// <param name="pFirst"></param>
 /// <param name="pLast"></param>
 public void CreateControl(DIYReport.ReportModel.RptObjType pType, Point pFirst, Point pLast)
 {
     CreateControl(null, true, pType, pFirst, pLast);
 }
Exemple #8
0
 public RptImage(string pName, DIYReport.ReportModel.RptObjType type) : base(pName, type)
 {
 }
Exemple #9
0
 /// <summary>
 /// 通过指定的类型增加一个
 /// </summary>
 /// <param name="pType"></param>
 /// <returns></returns>
 public IRptSingleObj AddByType(DIYReport.ReportModel.RptObjType pType, DIYReport.ReportModel.RptSection pSection)
 {
     return(AddByType(pType, null, pSection));
 }
Exemple #10
0
 /// <summary>
 /// 绘制控件选择控件类型相关。
 /// </summary>
 /// <param name="cmdID"></param>
 public void ExecRptCtlType(CommandID cmdID)
 {
     DIYReport.ReportModel.RptObjType type = DIYReport.ReportModel.RptObjType.None;
     if (cmdID.Equals(RptDesignCommands.RptNone))
     {
         type = DIYReport.ReportModel.RptObjType.None;
     }
     else if (cmdID.Equals(RptDesignCommands.RptLabel))
     {
         type = DIYReport.ReportModel.RptObjType.Text;
     }
     else if (cmdID.Equals(RptDesignCommands.RptFieldText))
     {
         type = DIYReport.ReportModel.RptObjType.FieldTextBox;
     }
     else if (cmdID.Equals(RptDesignCommands.RptFieldImage))
     {
         type = DIYReport.ReportModel.RptObjType.FieldImage;
     }
     else if (cmdID.Equals(RptDesignCommands.RptPictureBox))
     {
         type = DIYReport.ReportModel.RptObjType.Image;
     }
     else if (cmdID.Equals(RptDesignCommands.RptCheckBox))
     {
         type = DIYReport.ReportModel.RptObjType.CheckBox;
     }
     else if (cmdID.Equals(RptDesignCommands.RptSubReport))
     {
         type = DIYReport.ReportModel.RptObjType.SubReport;
     }
     else if (cmdID.Equals(RptDesignCommands.RptBarCode))
     {
         type = DIYReport.ReportModel.RptObjType.BarCode;
     }
     else if (cmdID.Equals(RptDesignCommands.RptOleObject))
     {
         type = DIYReport.ReportModel.RptObjType.OleObject;
     }
     else if (cmdID.Equals(RptDesignCommands.RptLine))
     {
         type = DIYReport.ReportModel.RptObjType.Line;
     }
     else if (cmdID.Equals(RptDesignCommands.RptFrame))
     {
         type = DIYReport.ReportModel.RptObjType.Rect;
     }
     else if (cmdID.Equals(RptDesignCommands.RptHViewSpecFieldBox))
     {
         type = DIYReport.ReportModel.RptObjType.HViewSpecField;
     }
     else if (cmdID.Equals(RptDesignCommands.RptExpressBox))
     {
         type = DIYReport.ReportModel.RptObjType.Express;
     }
     else if (cmdID.Equals(RptDesignCommands.RptRichTextBox))
     {
         type = DIYReport.ReportModel.RptObjType.RichTextBox;
     }
     else
     {
         Debug.Assert(false, "Command" + cmdID.ID.ToString() + "没有处理。");
     }
     DesignEnviroment.DrawControlType = type;
     DesignEnviroment.IsCreateControl = type != DIYReport.ReportModel.RptObjType.None;
 }
Exemple #11
0
 public RptTextObj(string pName, DIYReport.ReportModel.RptObjType pType) : base(pName, pType)
 {
     _Font      = new Font("Tahoma", 9);
     _Alignment = StringAlignment.Near;
     _ShowFrame = true;
 }
Exemple #12
0
 /// <summary>
 /// 根据类型创建报表对象。
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public static DIYReport.Interface.IRptSingleObj CreateObj(DIYReport.ReportModel.RptObjType pType)
 {
     return(CreateObj(pType, null));
 }