Exemplo n.º 1
0
        /// <summary>
        /// 通过鼠标选择控件
        /// </summary>
        /// <param name="pRect"></param>
        public void SelectCtlByMouseRect(Point pFirst, Point pLast)
        {
            //把鼠标选择的坐标转换成从左上到右下的选择方式
            Rectangle rect = PublicFun.ChangeMousePointToRect(pFirst, pLast);

            SelectCtlByMouseRect(rect);
        }
Exemplo n.º 2
0
        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;
        }