|
|
|
|
@ -17,22 +17,48 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
@@ -17,22 +17,48 @@ namespace ICSharpCode.Reports.Core.BaseClasses.Printing
|
|
|
|
|
|
|
|
|
|
public static Size MeasureReportItem(Graphics graphics,IReportItem item) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
BaseTextItem textItem = item as BaseTextItem; |
|
|
|
|
if (textItem != null) { |
|
|
|
|
if (textItem != null) |
|
|
|
|
{ |
|
|
|
|
string str = String.Empty; |
|
|
|
|
BaseDataItem dataItem = item as BaseDataItem; |
|
|
|
|
if (dataItem != null) { |
|
|
|
|
if (dataItem != null) |
|
|
|
|
{ |
|
|
|
|
str = dataItem.DBValue; |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
BaseTextItem it = item as BaseTextItem; |
|
|
|
|
if (it != null) { |
|
|
|
|
|
|
|
|
|
if (it != null) |
|
|
|
|
{ |
|
|
|
|
str = it.Text; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
if (str.Contains(Environment.NewLine)) |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine ("newline"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int lp = 0; |
|
|
|
|
int cp = 0; |
|
|
|
|
SizeF test = graphics.MeasureString(str.TrimEnd(), textItem.Font, textItem.Size, |
|
|
|
|
|
|
|
|
|
StringFormat.GenericTypographic,out cp, out lp); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
SizeF sf = graphics.MeasureString(str.TrimEnd(), |
|
|
|
|
textItem.Font, |
|
|
|
|
textItem.Size.Width); |
|
|
|
|
var hh = textItem.Font.GetHeight(); |
|
|
|
|
var h1 = textItem.Font.Height; |
|
|
|
|
var aa = sf.Height / textItem.Font.GetHeight(); |
|
|
|
|
|
|
|
|
|
return sf.ToSize(); |
|
|
|
|
} |
|
|
|
|
return item.Size; |
|
|
|
|
|