|
|
|
@ -60,6 +60,11 @@ namespace ICSharpCode.Reports.Core.WPF
@@ -60,6 +60,11 @@ namespace ICSharpCode.Reports.Core.WPF
|
|
|
|
|
UIElement element = null; |
|
|
|
|
System.Windows.Controls.Border border = null; |
|
|
|
|
|
|
|
|
|
var graphicContainer = column as ExportGraphicContainer; |
|
|
|
|
if ( graphicContainer != null) { |
|
|
|
|
element = CreateGraphicsContainer(graphicContainer); |
|
|
|
|
return element; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var container = column as ExportContainer; |
|
|
|
|
if (container != null) { |
|
|
|
@ -73,19 +78,15 @@ namespace ICSharpCode.Reports.Core.WPF
@@ -73,19 +78,15 @@ namespace ICSharpCode.Reports.Core.WPF
|
|
|
|
|
|
|
|
|
|
var text = column as ExportText; |
|
|
|
|
if (text != null) { |
|
|
|
|
|
|
|
|
|
var t = CreateTextBlock(text); |
|
|
|
|
if (column.StyleDecorator.DrawBorder) { |
|
|
|
|
border = new System.Windows.Controls.Border(); |
|
|
|
|
border.Padding = new Thickness(1); |
|
|
|
|
border.BorderThickness = new Thickness(2); |
|
|
|
|
border.CornerRadius = new CornerRadius(2); |
|
|
|
|
border.BorderBrush = brushConverter.ConvertFromString(column.StyleDecorator.ForeColor.Name) as SolidColorBrush; |
|
|
|
|
var t = CreateTextBlock(text); |
|
|
|
|
border = CreateBorder(column.StyleDecorator as BaseStyleDecorator); |
|
|
|
|
border.Child = t; |
|
|
|
|
element = border; |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
element = CreateTextBlock (text); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
element = t; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -97,10 +98,23 @@ namespace ICSharpCode.Reports.Core.WPF
@@ -97,10 +98,23 @@ namespace ICSharpCode.Reports.Core.WPF
|
|
|
|
|
element = CreateImageColumn(image); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return element; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region GraphicsElement (Line etc)
|
|
|
|
|
|
|
|
|
|
System.Windows.Controls.Border CreateBorder( BaseStyleDecorator column) |
|
|
|
|
{ |
|
|
|
|
var border = new System.Windows.Controls.Border(); |
|
|
|
|
border.Padding = new Thickness(1); |
|
|
|
|
border.BorderThickness = new Thickness(2); |
|
|
|
|
border.CornerRadius = new CornerRadius(2); |
|
|
|
|
border.BorderBrush = brushConverter.ConvertFromString(column.ForeColor.Name) as SolidColorBrush; |
|
|
|
|
return border; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIElement CreateGraphicsElement(ExportGraphic column) |
|
|
|
|
{ |
|
|
|
|
var line = new System.Windows.Shapes.Line(); |
|
|
|
@ -111,33 +125,65 @@ namespace ICSharpCode.Reports.Core.WPF
@@ -111,33 +125,65 @@ namespace ICSharpCode.Reports.Core.WPF
|
|
|
|
|
|
|
|
|
|
if (ld != null) { |
|
|
|
|
line.X1 = ld.From.X; |
|
|
|
|
line.Y1 = ld.From.Y; |
|
|
|
|
line.X2 = ld.To.X; |
|
|
|
|
line.Y2 = ld.To.Y; |
|
|
|
|
line.Y1 = ld.From.Y; |
|
|
|
|
line.X2 = ld.To.X; |
|
|
|
|
line.Y2 = ld.To.Y; |
|
|
|
|
} else { |
|
|
|
|
line.X1 = column.StyleDecorator.Location.X; |
|
|
|
|
line.Y1 = column.StyleDecorator.Location.Y; |
|
|
|
|
line.X2 = column.StyleDecorator.DisplayRectangle.Width; |
|
|
|
|
line.Y2 = column.StyleDecorator.Location.Y; |
|
|
|
|
line.Y1 = column.StyleDecorator.Location.Y; |
|
|
|
|
line.X2 = column.StyleDecorator.DisplayRectangle.Width; |
|
|
|
|
line.Y2 = column.StyleDecorator.Location.Y; |
|
|
|
|
} |
|
|
|
|
return line; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private UIElement CreateContainer(ExportContainer container) |
|
|
|
|
#region Container
|
|
|
|
|
UIElement CreateGraphicsContainer(ExportGraphicContainer graphicContainer) |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine("GraphicContainer"); |
|
|
|
|
IGraphicStyleDecorator decorator = graphicContainer.StyleDecorator as IGraphicStyleDecorator; |
|
|
|
|
UIElement shape = null; |
|
|
|
|
var ss = decorator.Shape as EllipseShape; |
|
|
|
|
|
|
|
|
|
if (ss != null) { |
|
|
|
|
|
|
|
|
|
var circle = new System.Windows.Shapes.Ellipse(); |
|
|
|
|
SetDimension(circle,decorator); |
|
|
|
|
circle.Fill = brushConverter.ConvertFromString(decorator.BackColor.Name) as SolidColorBrush; |
|
|
|
|
circle.StrokeThickness = decorator.Thickness; |
|
|
|
|
circle.Stroke = brushConverter.ConvertFromString(decorator.ForeColor.Name) as SolidColorBrush; |
|
|
|
|
shape = circle; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var canvas = new Canvas(); |
|
|
|
|
canvas.Width = container.StyleDecorator.DisplayRectangle.Width; |
|
|
|
|
canvas.Height = container.StyleDecorator.DisplayRectangle.Height; |
|
|
|
|
|
|
|
|
|
var rect = container as ExportGraphicContainer; |
|
|
|
|
if (rect != null) { |
|
|
|
|
Console.WriteLine("GraphicContainer"); |
|
|
|
|
var bs = rect.StyleDecorator as IGraphicStyleDecorator; |
|
|
|
|
DrawShape (canvas,bs); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
var border = CreateBorder(decorator as BaseStyleDecorator); |
|
|
|
|
SetDimension(border,decorator); |
|
|
|
|
|
|
|
|
|
RectangleShape rs = decorator.Shape as RectangleShape; |
|
|
|
|
|
|
|
|
|
border.CornerRadius = new CornerRadius(rs.CornerRadius); |
|
|
|
|
border.BorderThickness = new Thickness(decorator.Thickness); |
|
|
|
|
border.BorderBrush = brushConverter.ConvertFromString(decorator.ForeColor.Name) as SolidColorBrush; |
|
|
|
|
shape = border; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return shape; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UIElement CreateContainer(ExportContainer container) |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine("CreateContainer"); |
|
|
|
|
var canvas = new Canvas(); |
|
|
|
|
SetDimension(canvas,container.StyleDecorator); |
|
|
|
|
|
|
|
|
|
SolidColorBrush backgroundBrush = brushConverter.ConvertFromString(container.StyleDecorator.BackColor.Name) as SolidColorBrush; |
|
|
|
|
canvas.Background = backgroundBrush; |
|
|
|
@ -155,11 +201,25 @@ namespace ICSharpCode.Reports.Core.WPF
@@ -155,11 +201,25 @@ namespace ICSharpCode.Reports.Core.WPF
|
|
|
|
|
return canvas; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DrawShape(Canvas canvas, IGraphicStyleDecorator bs) |
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
void CreateShape(Canvas canvas, IGraphicStyleDecorator bs) |
|
|
|
|
{ |
|
|
|
|
var shape = bs.Shape; |
|
|
|
|
UIElement element = null; |
|
|
|
|
if (shape is RectangleShape) { |
|
|
|
|
element = new System.Windows.Controls.Border(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (element != null) { |
|
|
|
|
canvas.Children.Add(element); |
|
|
|
|
Canvas.SetLeft(element,bs.Location.X); |
|
|
|
|
Canvas.SetTop(element,bs.Location.Y); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIElement CreateTextColumn(ExportText et) |
|
|
|
@ -169,13 +229,14 @@ namespace ICSharpCode.Reports.Core.WPF
@@ -169,13 +229,14 @@ namespace ICSharpCode.Reports.Core.WPF
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Image
|
|
|
|
|
|
|
|
|
|
UIElement CreateImageColumn(ExportImage exportImage) |
|
|
|
|
{ |
|
|
|
|
System.Windows.Media.Imaging.BitmapImage bitmap = BitmapFromImage(exportImage); |
|
|
|
|
Image image = new Image(); |
|
|
|
|
image.Source = bitmap; |
|
|
|
|
image.Width = exportImage.StyleDecorator.DisplayRectangle.Width; |
|
|
|
|
image.Height = exportImage.StyleDecorator.DisplayRectangle.Height; |
|
|
|
|
SetDimension(image,exportImage.StyleDecorator); |
|
|
|
|
image.Stretch = System.Windows.Media.Stretch.Fill; |
|
|
|
|
return image; |
|
|
|
|
} |
|
|
|
@ -193,47 +254,44 @@ namespace ICSharpCode.Reports.Core.WPF
@@ -193,47 +254,44 @@ namespace ICSharpCode.Reports.Core.WPF
|
|
|
|
|
return bitmap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TextBlock CreateTextBlock(ExportText et) |
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region TextBlock
|
|
|
|
|
|
|
|
|
|
TextBlock CreateTextBlock(ExportText exportText) |
|
|
|
|
{ |
|
|
|
|
TextBlock tb = new TextBlock(); |
|
|
|
|
tb.Text = et.Text; |
|
|
|
|
SetFont(tb, et.StyleDecorator); |
|
|
|
|
tb.Width = et.StyleDecorator.DisplayRectangle.Width; |
|
|
|
|
tb.Height = et.StyleDecorator.DisplayRectangle.Height; |
|
|
|
|
// SetDimension(tb,et.StyleDecorator);
|
|
|
|
|
tb.MaxHeight = et.StyleDecorator.DisplayRectangle.Height; |
|
|
|
|
tb.MaxWidth = et.StyleDecorator.DisplayRectangle.Width; |
|
|
|
|
return tb; |
|
|
|
|
TextBlock textBlock = new TextBlock(); |
|
|
|
|
textBlock.Text = exportText.Text; |
|
|
|
|
SetFont(textBlock, exportText.StyleDecorator); |
|
|
|
|
SetDimension(textBlock,exportText.StyleDecorator); |
|
|
|
|
return textBlock; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// void SetDimension (System.Windows.Controls.Control element,BaseStyleDecorator decorator)
|
|
|
|
|
// {
|
|
|
|
|
// element.Width = decorator.DisplayRectangle.Width;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
void SetFont(TextBlock tb, TextStyleDecorator styleDecorator) |
|
|
|
|
|
|
|
|
|
void SetFont(TextBlock textBlock, TextStyleDecorator styleDecorator) |
|
|
|
|
{ |
|
|
|
|
tb.FontFamily = new FontFamily(styleDecorator.Font.FontFamily.Name); |
|
|
|
|
textBlock.FontFamily = new FontFamily(styleDecorator.Font.FontFamily.Name); |
|
|
|
|
var b = styleDecorator.Font.Size; |
|
|
|
|
tb.FontSize = b * 96/72; |
|
|
|
|
tb.Foreground = brushConverter.ConvertFromString(styleDecorator.ForeColor.Name) as SolidColorBrush; |
|
|
|
|
textBlock.FontSize = b * 96/72; |
|
|
|
|
textBlock.Foreground = brushConverter.ConvertFromString(styleDecorator.ForeColor.Name) as SolidColorBrush; |
|
|
|
|
if (styleDecorator.Font.Bold) { |
|
|
|
|
tb.FontWeight = FontWeights.Bold; |
|
|
|
|
textBlock.FontWeight = FontWeights.Bold; |
|
|
|
|
} |
|
|
|
|
if (styleDecorator.Font.Underline) { |
|
|
|
|
CreateUnderline(tb,styleDecorator); |
|
|
|
|
CreateUnderline(textBlock,styleDecorator); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (styleDecorator.Font.Italic) { |
|
|
|
|
tb.FontStyle = System.Windows.FontStyles.Italic ; |
|
|
|
|
textBlock.FontStyle = System.Windows.FontStyles.Italic ; |
|
|
|
|
} |
|
|
|
|
if (styleDecorator.Font.Strikeout) { |
|
|
|
|
CreateStrikeout(tb,styleDecorator); |
|
|
|
|
CreateStrikeout(textBlock,styleDecorator); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CreateStrikeout (TextBlock tb, TextStyleDecorator styleDecorator) |
|
|
|
|
void CreateStrikeout (TextBlock textBlock, TextStyleDecorator styleDecorator) |
|
|
|
|
{ |
|
|
|
|
TextDecoration strikeOut = new TextDecoration(); |
|
|
|
|
strikeOut.Location = TextDecorationLocation.Strikethrough; |
|
|
|
@ -241,20 +299,22 @@ namespace ICSharpCode.Reports.Core.WPF
@@ -241,20 +299,22 @@ namespace ICSharpCode.Reports.Core.WPF
|
|
|
|
|
Pen p = CreateWpfPen(styleDecorator); |
|
|
|
|
strikeOut.Pen = p ; |
|
|
|
|
strikeOut.PenThicknessUnit = TextDecorationUnit.FontRecommended; |
|
|
|
|
tb.TextDecorations.Add(strikeOut); |
|
|
|
|
textBlock.TextDecorations.Add(strikeOut); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CreateUnderline(TextBlock tb,TextStyleDecorator styleDecorator) |
|
|
|
|
|
|
|
|
|
void CreateUnderline(TextBlock textBlock,TextStyleDecorator styleDecorator) |
|
|
|
|
{ |
|
|
|
|
TextDecoration underLine = new TextDecoration(); |
|
|
|
|
Pen p = CreateWpfPen(styleDecorator); |
|
|
|
|
underLine.Pen = p ; |
|
|
|
|
underLine.PenThicknessUnit = TextDecorationUnit.FontRecommended; |
|
|
|
|
tb.TextDecorations.Add(underLine); |
|
|
|
|
textBlock.TextDecorations.Add(underLine); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
Pen CreateWpfPen(TextStyleDecorator styleDecorator) |
|
|
|
|
Pen CreateWpfPen(TextStyleDecorator styleDecorator) |
|
|
|
|
{ |
|
|
|
|
Pen myPen = new Pen(); |
|
|
|
|
SolidColorBrush underlineBrush = brushConverter.ConvertFromString(styleDecorator.ForeColor.Name) as SolidColorBrush; |
|
|
|
@ -264,6 +324,15 @@ namespace ICSharpCode.Reports.Core.WPF
@@ -264,6 +324,15 @@ namespace ICSharpCode.Reports.Core.WPF
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SetDimension (FrameworkElement element,IBaseStyleDecorator decorator) |
|
|
|
|
{ |
|
|
|
|
element.Width = decorator.DisplayRectangle.Width; |
|
|
|
|
element.Height = decorator.DisplayRectangle.Height; |
|
|
|
|
// element.MaxHeight = decorator.DisplayRectangle.Height;
|
|
|
|
|
// element.MaxWidth = decorator.DisplayRectangle.Width;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ArrangePage(Size pageSize, FixedPage page) |
|
|
|
|
{ |
|
|
|
|
page.Measure(pageSize); |
|
|
|
|