Exemplo n.º 1
0
//		//画线
//		private void drawLine(Graphics g){
//			SolidBrush brush = new SolidBrush(_DataObj.ForeColor);
//			DIYReport.ReportModel.RptObj.RptLine obj = _DataObj as  DIYReport.ReportModel.RptObj.RptLine;
//			Point p1 = new Point(0,0);
//			Point p2 = new Point(_DataObj.Size.Width,_DataObj.Size.Height);
//			switch(obj.LineType){
//				case DIYReport.ReportModel.LineType.Horizon://水平线
//					p2 = new Point(_DataObj.Size.Width,0);
//					break;
//				case DIYReport.ReportModel.LineType.Vertical ://垂直线
//					p2 = new Point(0,_DataObj.Size.Height);
//					break;
//				case DIYReport.ReportModel.LineType.Bias:// 斜线
//					p2 = new Point(_DataObj.Size.Width,_DataObj.Size.Height);
//					break;
//				case DIYReport.ReportModel.LineType.Backlash://反 斜线
//					p1= new Point(0,_DataObj.Size.Height);
//					p2 =  new Point(_DataObj.Size.Width,0);
//					break;
//				default:
//					Debug.Assert(false,"该类型还没有设置!","");
//					break;
//			}
//			Pen pen = new Pen(brush,_DataObj.LinePound);
//			pen.DashStyle = _DataObj.LineStyle ;
//			g.DrawLine(pen,p1,p2);
//		}
//		//画边框
//		private void drawFrame(Graphics g){
//			SolidBrush brush = new SolidBrush(_DataObj.ForeColor);
//			Pen pen = new Pen(brush,_DataObj.LinePound);
//			pen.DashStyle = _DataObj.LineStyle ;
//			g.DrawRectangle(pen,_DataObj.InnerRect);
//		}
//		//画Lable和数据
//		private void drawLableAndTextBox(Graphics g,bool pIsLable){
//			StringFormat strFormat = new StringFormat();
//			DIYReport.Interface.IRptTextObj obj = _DataObj as    DIYReport.Interface.IRptTextObj;
//			SolidBrush brush = new SolidBrush(_DataObj.ForeColor);
//
//			if(obj.WordWrap==false) {
//				strFormat.Trimming = StringTrimming.EllipsisCharacter;
//				strFormat.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.LineLimit;
//			}
//			else {
//				strFormat.FormatFlags = StringFormatFlags.LineLimit;
//			}
//			strFormat.Alignment = obj.Alignment;
//			string txt ="";
//			if( pIsLable){
//				txt = (_DataObj as RptLable).Text;
//			}
//			else{
//				RptExpressBox exObj = _DataObj as RptExpressBox;
//				if( exObj.ExpressType!= ExpressType.Express){
//					txt = "@" + exObj.DataSource;
//				}
//				else{
//					txt = "@" + exObj.DataSource +"(" + exObj.FieldName + ")";
//				}
//			}
//			SizeF fontSize = g.MeasureString("A",obj.Font);
//			float fontFirstY =(_DataObj.Size.Height - fontSize.Height)/2;
//			g.DrawString(txt,obj.Font,brush ,new RectangleF(new PointF(0,fontFirstY),  _DataObj.Size),strFormat);
//			if(obj.ShowFrame){
//				Pen pen = new Pen(brush,_DataObj.LinePound);
//				pen.DashStyle = _DataObj.LineStyle ;
//				g.DrawRectangle(pen,_DataObj.InnerRect);
//			}
//		}
//		//画Image 图像
//		private void drawImage(Graphics g) {
//		 DIYReport.ReportModel.RptObj.RptPictureBox pic = _DataObj as DIYReport.ReportModel.RptObj.RptPictureBox;
//			SolidBrush brush = new SolidBrush(_DataObj.ForeColor);
//			if(pic.Image!=null){
//				g.DrawImageUnscaled(pic.Image ,0,0);
////				try{
////					pic.Image.Dispose();
////				}
////				catch{}
//			}
//			g.DrawRectangle(new Pen(brush,_DataObj.LinePound),_DataObj.InnerRect);
//		}
        #endregion 绘制相应的控件...

        private void DesignControl_DoubleClick(object sender, System.EventArgs e)
        {
            DesignEnviroment.ShowPropertyForm(this.ParentForm, true);
        }
Exemplo n.º 2
0
        private void tlbTopBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
            //e.Button.Tag 的0-5为存储格式控件操作样式的
            this.Cursor = Cursors.WaitCursor;
            if (e.Button.Tag != null)
            {
                int index = int.Parse(e.Button.Tag.ToString());
                if (index < 6)
                {
                    DesignSection section = _SectionList.GetActiveSection();
                    section.DesignControls.FormatCtl((DIYReport.UserDIY.FormatCtlType)index);
                }
                switch (index)
                {
                case 6:                        //向左边靠齐
                    _SectionList.GetActiveSection().DesignControls.DockToLeft();
                    break;

                case 7:                        //向右边靠齐
                    _SectionList.GetActiveSection().DesignControls.DockToTop();
                    break;

                case 8:                        //显示方向控制盘
                    FrmArrowOperate.ShowArrowForm(_SectionList, this.ParentForm);
                    break;

                case 16:
                    //显示属性窗口
                    DesignEnviroment.ShowPropertyForm(this.ParentForm, true);
                    break;

                case 17:
                    //删除控件
                    DeleteSelectedControls();
                    break;

                case 18:                        //打印
                    using (DIYReport.Print.SwPrintView print = new DIYReport.Print.SwPrintView(DIYReport.UserDIY.DesignEnviroment.DataSource, _DataObj)){
                        print.Printer();
                    }
                    break;

                case 19:                        //打印预览
                    using (DIYReport.Print.SwPrintView printView = new DIYReport.Print.SwPrintView(DIYReport.UserDIY.DesignEnviroment.DataSource, _DataObj)){
                        printView.ShowPreview();
                    }
                    break;

                case 20:                        //打印页面设置
                    DIYReport.Print.RptPageSetting.ShowPageSetupDialog(_DataObj);
                    break;

                case 21:                        //保存报表
                    _ReportIO.SaveReport(_DataObj, null);
                    DIYReport.UserDIY.DesignEnviroment.DesignHasChanged = false;
                    break;

                case 22:                        //打开报表
                    DIYReport.ReportModel.RptReport report = _ReportIO.Open();
                    if (report != null)
                    {
                        OpenReport(report);
                    }
                    break;

                case 23:                        //新增报表
                                                //CreateNewReport();
                                                //MessageBox.Show("当前不支持从这里新建一张报表摸板.","操作提示");
                                                //暂时把它修改为打印摸板的导出功能。
                    _ReportIO.Save(_DataObj);
                    break;

                case 24:                         //Undo
                    _UndoMgr.Undo();
                    break;

                case 25:                         //Redo
                    _UndoMgr.Redo();
                    break;

                case 26:                          //显示分组和排序
                    IList fieldsList = DIYReport.UserDIY.DesignEnviroment.CurrentReport.DesignField;

                    DIYReport.GroupAndSort.frmSortAndGroup frm = new DIYReport.GroupAndSort.frmSortAndGroup(fieldsList);
                    frm.AfterSortAndGroup += new DIYReport.GroupAndSort.SortAndGroupEventHandler(frm_AfterSortAndGroup);
                    frm.ShowDialog();
                    break;

                default:
                    break;
                }
            }
            this.Cursor = Cursors.Arrow;
        }