Ejemplo n.º 1
0
		///<summary>Font default is Tahoma 9pt</summary>
		public void AddSummaryLabel(string dataFieldName,string summaryText,SummaryOrientation summaryOrientation,bool hasWordWrap) {
			AddSummaryLabel(dataFieldName,summaryText,summaryOrientation,hasWordWrap,new Font("Tahoma",9));
		}
Ejemplo n.º 2
0
		///<summary>Add a label to a summaryfield based on the orientation given.</summary>
		public void AddSummaryLabel(string dataFieldName,string summaryText,SummaryOrientation summaryOrientation,bool hasWordWrap,Font font) {
			Graphics grfx=Graphics.FromImage(new Bitmap(1,1));
			ReportObject summaryField=GetObjectByName(dataFieldName+"Footer");
			Size size;
			if(hasWordWrap) {
				size=new Size(summaryField.Size.Width,(int)(grfx.MeasureString(summaryText,font,summaryField.Size.Width).Height/grfx.DpiY*100+2));
			}
			else {
				size=new Size((int)(grfx.MeasureString(summaryText,font).Width/grfx.DpiX*100+2),(int)(grfx.MeasureString(summaryText,font).Height/grfx.DpiY*100+2));
			}
			if(summaryOrientation==SummaryOrientation.North) {
				ReportObject summaryLabel=new ReportObject(dataFieldName+"Label","Group Footer"
						,summaryField.Location
						,size
						,summaryText
						,font
						,summaryField.ContentAlignment);
				summaryLabel.DataField=dataFieldName;
				summaryLabel.SummaryOrientation=summaryOrientation;
				_reportObjects.Insert(_reportObjects.IndexOf(summaryField),summaryLabel);
			}
			else if(summaryOrientation==SummaryOrientation.South) {
				ReportObject summaryLabel=new ReportObject(dataFieldName+"Label","Group Footer"
						,summaryField.Location
						,size
						,summaryText
						,font
						,summaryField.ContentAlignment);
				summaryLabel.DataField=dataFieldName;
				summaryLabel.SummaryOrientation=summaryOrientation;
				_reportObjects.Add(summaryLabel);
			}
			else if(summaryOrientation==SummaryOrientation.West) {
				ReportObject summaryLabel=new ReportObject(dataFieldName+"Label","Group Footer"
						,new Point(summaryField.Location.X-size.Width)
						,size
						,summaryText
						,font
						,summaryField.ContentAlignment);
				summaryLabel.DataField=dataFieldName;
				summaryLabel.SummaryOrientation=summaryOrientation;
				_reportObjects.Insert(_reportObjects.IndexOf(summaryField),summaryLabel);
			}
			else {
				ReportObject summaryLabel=new ReportObject(dataFieldName+"Label","Group Footer"
						,new Point(summaryField.Location.X+size.Width+summaryField.Size.Width)
						,size
						,summaryText
						,font
						,summaryField.ContentAlignment);
				summaryLabel.DataField=dataFieldName;
				summaryLabel.SummaryOrientation=summaryOrientation;
				_reportObjects.Insert(_reportObjects.IndexOf(summaryField)+1,summaryLabel);
			}
			grfx.Dispose();
		}