|
|
|
@ -15,9 +15,11 @@ using ICSharpCode.Reports.Core.Exporter;
@@ -15,9 +15,11 @@ using ICSharpCode.Reports.Core.Exporter;
|
|
|
|
|
/// created on - 09.10.2005 18:20:51
|
|
|
|
|
/// </remarks>
|
|
|
|
|
namespace ICSharpCode.Reports.Core { |
|
|
|
|
|
|
|
|
|
public class RectangleShape : BaseShape { |
|
|
|
|
|
|
|
|
|
public RectangleShape() { |
|
|
|
|
public RectangleShape() |
|
|
|
|
{ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -27,22 +29,46 @@ namespace ICSharpCode.Reports.Core {
@@ -27,22 +29,46 @@ namespace ICSharpCode.Reports.Core {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override GraphicsPath CreatePath(Rectangle rectangle){ |
|
|
|
|
GraphicsPath path1 = new GraphicsPath(); |
|
|
|
|
path1.AddRectangle(rectangle); |
|
|
|
|
return path1; |
|
|
|
|
public override GraphicsPath CreatePath(Rectangle rectangle ) |
|
|
|
|
{ |
|
|
|
|
//http://stackoverflow.com/questions/628261/how-to-draw-rounded-rectangle-with-variable-width-border-inside-of-specific-bound
|
|
|
|
|
//http://www.switchonthecode.com/tutorials/csharp-creating-rounded-rectangles-using-a-graphics-path
|
|
|
|
|
//http://www.codeproject.com/KB/GDI-plus/ExtendedGraphics.aspx
|
|
|
|
|
|
|
|
|
|
GraphicsPath gfxPath = new GraphicsPath(); |
|
|
|
|
if (CornerRadius == 0) |
|
|
|
|
{ |
|
|
|
|
gfxPath.AddRectangle(rectangle); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
gfxPath.AddArc(rectangle.X, rectangle.Y,CornerRadius , CornerRadius, 180, 90); |
|
|
|
|
gfxPath.AddArc(rectangle.X + rectangle.Width - CornerRadius, rectangle.Y, CornerRadius, CornerRadius, 270, 90); |
|
|
|
|
gfxPath.AddArc(rectangle.X + rectangle.Width - CornerRadius, rectangle.Y + rectangle.Height - CornerRadius, CornerRadius, CornerRadius, 0, 90); |
|
|
|
|
gfxPath.AddArc(rectangle.X, rectangle.Y + rectangle.Height - CornerRadius, CornerRadius, CornerRadius, 90, 90); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
gfxPath.CloseAllFigures(); |
|
|
|
|
return gfxPath; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void DrawShape(Graphics graphics, BaseLine line, Rectangle rectangle) |
|
|
|
|
{ |
|
|
|
|
base.DrawShape(graphics, line, rectangle); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void CreatePath(iTextSharp.text.pdf.PdfContentByte contentByte, |
|
|
|
|
BaseLine line, |
|
|
|
|
IBaseStyleDecorator style, |
|
|
|
|
|
|
|
|
|
Point from,Point to) |
|
|
|
|
{ |
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// http://www.mikesdotnetting.com/Article/88/iTextSharp-Drawing-shapes-and-Graphics
|
|
|
|
|
|
|
|
|
|
public override void CreatePath(iTextSharp.text.pdf.PdfContentByte contentByte, |
|
|
|
|
BaseLine line, |
|
|
|
@ -52,6 +78,9 @@ namespace ICSharpCode.Reports.Core {
@@ -52,6 +78,9 @@ namespace ICSharpCode.Reports.Core {
|
|
|
|
|
if (contentByte == null) { |
|
|
|
|
throw new ArgumentNullException("contentByte"); |
|
|
|
|
} |
|
|
|
|
if (line == null) { |
|
|
|
|
throw new ArgumentNullException("line"); |
|
|
|
|
} |
|
|
|
|
if (style == null) { |
|
|
|
|
throw new ArgumentNullException("style"); |
|
|
|
|
} |
|
|
|
@ -59,21 +88,13 @@ namespace ICSharpCode.Reports.Core {
@@ -59,21 +88,13 @@ namespace ICSharpCode.Reports.Core {
|
|
|
|
|
throw new ArgumentNullException("rectangle"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ((line == null)||(line.Thickness < 1)) { |
|
|
|
|
BaseShape.FillBackGround(contentByte,style,rectangle); |
|
|
|
|
} |
|
|
|
|
else if ((style.BackColor == GlobalValues.DefaultBackColor)) { |
|
|
|
|
BaseShape.SetupShape(contentByte,style); |
|
|
|
|
contentByte.SetLineWidth(UnitConverter.FromPixel(line.Thickness).Point); |
|
|
|
|
contentByte.MoveTo(rectangle.Left ,rectangle.Top ); |
|
|
|
|
contentByte.LineTo(rectangle.Left, rectangle.Top - rectangle.Height); |
|
|
|
|
contentByte.LineTo(rectangle.Left + rectangle.Width, rectangle.Top - rectangle.Height); |
|
|
|
|
contentByte.LineTo(rectangle.Left + rectangle.Width, rectangle.Top); |
|
|
|
|
contentByte.LineTo(rectangle.Left, rectangle.Top); |
|
|
|
|
BaseShape.FinishShape(contentByte); |
|
|
|
|
} else { |
|
|
|
|
BaseShape.FillBackGround(contentByte,style,rectangle); |
|
|
|
|
} |
|
|
|
|
BaseShape.SetupShape(contentByte,style); |
|
|
|
|
contentByte.SetLineWidth(UnitConverter.FromPixel(line.Thickness).Point); |
|
|
|
|
contentByte.RoundRectangle(rectangle.Left, rectangle.Bottom, rectangle.Width, rectangle.Height, CornerRadius); |
|
|
|
|
BaseShape.FinishShape(contentByte); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int CornerRadius {get;set;} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|