From f8a7e02e13ad227855d75bb5763d17d9131a3ca4 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Fri, 28 Apr 2006 06:29:35 +0000 Subject: [PATCH] Visual Controls and ReportItems now use the same drawing functions git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1359 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Designer/VisualControls/ControlHelper.cs | 2 +- .../VisualControls/ReportControlBase.cs | 4 ++ .../VisualControls/ReportLineControl.cs | 2 +- .../VisualControls/ReportRectangleControl.cs | 6 +-- .../VisualControls/ReportRowControl.cs | 23 +++++++-- .../VisualControls/ReportTextControl.cs | 19 ++++++- .../ReportItems/TextBased/ItemsHelper.cs | 1 - .../ReportItems/TextBased/ReportRowItem.cs | 4 +- .../ReportItems/TextBased/ReportTextItem.cs | 1 + .../SharpReportCore/BaseItems/BaseTextItem.cs | 23 ++++----- .../BaseItems/Graphics/BaseRectangleItem.cs | 4 +- .../SharpReportCore/BaseItems/RowItem.cs | 29 ++++++----- .../Printing/Graphics/BaseLine.cs | 49 +++++++++++++++++-- .../Printing/Graphics/BaseShape.cs | 40 ++++++++++----- .../Printing/Graphics/EllipseShape.cs | 19 +++---- .../Printing/Graphics/FillPatterns.cs | 10 +++- .../Printing/Graphics/LineShape.cs | 22 +++------ .../Printing/Graphics/RectangleShape.cs | 27 +++------- 18 files changed, 174 insertions(+), 111 deletions(-) diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs index 72e3ac78f0..60a11f051b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs @@ -15,7 +15,7 @@ namespace SharpReport.Designer /// /// Description of ControlHelper. /// - internal class ControlHelper{ + public class ControlHelper{ Control control; public ControlHelper(Control control){ diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs index 71a1ea8781..94a5240d2b 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs @@ -129,6 +129,10 @@ namespace SharpReport.Designer{ this.Invalidate(); } + protected Rectangle FocusRectangle { + get {return this.controlHelper.BuildFocusRectangle;} + } + #region Windows Forms Designer generated code /// /// This method is required for Windows Forms designer support. diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportLineControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportLineControl.cs index 42b4ffa126..0f78bb8df6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportLineControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportLineControl.cs @@ -39,7 +39,7 @@ namespace SharpReport.Designer{ protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea) { base.OnPaint(pea); base.DrawEdges (pea); - base.DrawDecorations(pea); +// base.DrawDecorations(pea); shape.DrawShape(pea.Graphics, new BaseLine (this.ForeColor,base.DashStyle,base.Thickness), diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs index 0b0763aa45..8209227905 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs @@ -41,15 +41,15 @@ namespace SharpReport.Designer { protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea) { base.OnPaint(pea); - base.DrawEdges (pea); base.DrawDecorations(pea); + shape.FillShape(pea.Graphics, new SolidFillPattern(this.BackColor), - (RectangleF)this.ClientRectangle); + (RectangleF)base.FocusRectangle); shape.DrawShape (pea.Graphics, new BaseLine (this.ForeColor,base.DashStyle,base.Thickness), - (RectangleF)this.ClientRectangle); + (RectangleF)base.FocusRectangle); } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs index 0ffed654de..498f7b6e5e 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs @@ -21,7 +21,8 @@ namespace SharpReport.Designer{ /// internal class ReportRowControl:ReportControlBase{ - + private RectangleShape shape = new RectangleShape(); + private bool drawBorder; public ReportRowControl():base(){ InitializeComponent(); this.SetStyle(ControlStyles.DoubleBuffer | @@ -39,10 +40,15 @@ namespace SharpReport.Designer{ #region overrides protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea){ base.OnPaint(pea); - - Rectangle r = new Rectangle(0,5,this.ClientSize.Width - 1,this.ClientSize.Height - 6); - base.DrawEdges (pea,r); + base.DrawEdges (pea, + new Rectangle(0,5,this.ClientSize.Width - 1,this.ClientSize.Height - 6) ); base.DrawDecorations(pea); + + if (this.drawBorder) { + shape.DrawShape (pea.Graphics, + new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1), + base.FocusRectangle); + } StringFormat fmt = GlobalValues.StandartStringFormat(); fmt.LineAlignment = StringAlignment.Near; @@ -54,11 +60,18 @@ namespace SharpReport.Designer{ } public override string ToString() { - return this.Name; + return this.GetType().Name; } #endregion + public bool DrawBorder { + set { + drawBorder = value; + this.Invalidate(); + } + } + #region Windows Forms Designer generated code /// /// This method is required for Windows Forms designer support. diff --git a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs index c1b1ca503e..82f2464afc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs @@ -21,8 +21,10 @@ namespace SharpReport.Designer{ private StringTrimming stringTrimming; private ContentAlignment contentAlignment; - TextDrawer textDrawer = new TextDrawer(); + private bool drawBorder; + private TextDrawer textDrawer = new TextDrawer(); + private RectangleShape shape = new RectangleShape(); public ReportTextControl():base(){ InitializeComponent(); @@ -36,6 +38,12 @@ namespace SharpReport.Designer{ this.Size = GlobalValues.PreferedSize; } + public bool DrawBorder { + set { + drawBorder = value; + this.Invalidate(); + } + } @@ -61,7 +69,7 @@ namespace SharpReport.Designer{ } protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea){ - + base.OnPaint(pea); base.DrawEdges (pea); base.DrawDecorations(pea); @@ -74,9 +82,16 @@ namespace SharpReport.Designer{ str = this.Text; } + if (this.drawBorder) { + shape.DrawShape (pea.Graphics, + new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1), + base.FocusRectangle); + } + this.textDrawer.DrawString (pea.Graphics,this.Text,this.Font, new SolidBrush(this.ForeColor),(RectangleF)this.ClientRectangle, this.stringTrimming,this.contentAlignment); + } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs index 468da15ed0..85e3bc396f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs @@ -53,7 +53,6 @@ namespace SharpReport { control.Size = item.Size; control.Font = item.Font; control.Name = item.Name; - BaseTextItem b = item as BaseTextItem; } diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs index 45ff2ff93e..bbd7b10a09 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs @@ -108,6 +108,7 @@ namespace SharpReport.ReportItems private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ ItemsHelper.UpdateControlFromTextBase (this.visualControl,this); + this.visualControl.DrawBorder = base.DrawBorder; this.HandlePropertyChanged(e.PropertyName); } @@ -115,6 +116,7 @@ namespace SharpReport.ReportItems private void OnControlChanged (object sender, EventArgs e) { this.SuspendLayout(); ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); + this.ResumeLayout(); this.HandlePropertyChanged("OnControlChanged"); @@ -206,7 +208,7 @@ namespace SharpReport.ReportItems } public override string ToString(){ - return this.Name; + return this.GetType().Name; } #endregion diff --git a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs index 95a54029e1..a1739baa4f 100644 --- a/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs @@ -57,6 +57,7 @@ namespace SharpReport.ReportItems { this.visualControl.ContentAlignment = base.ContentAlignment; this.visualControl.StringTrimming = base.StringTrimming; + this.visualControl.DrawBorder = base.DrawBorder; this.HandlePropertyChanged(e.PropertyName); } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs index b800ff6343..bfaf0c8399 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs @@ -30,6 +30,7 @@ namespace SharpReportCore { private StringTrimming stringTrimming; private TextDrawer textDrawer = new TextDrawer(); private ContentAlignment contentAlignment; + private RectangleShape shape = new RectangleShape(); #region Constructor @@ -63,27 +64,21 @@ namespace SharpReportCore { } protected void FillBackGround (Graphics graphics,RectangleF rectangle) { - using (SolidBrush brush = new SolidBrush(base.BackColor)) { - graphics.FillRectangle(brush,rectangle); - } + shape.FillShape(graphics, + new SolidFillPattern(this.BackColor), + rectangle); } - protected void DrawFrame (Graphics graphics,Rectangle border) { + protected void DrawFrame (Graphics graphics,Rectangle rectangle) { if (base.DrawBorder == true) { - using (Pen pen = new Pen(Color.Black, 1)) { - graphics.DrawRectangle (pen,border); - } - //TODO use this class to draw a border -// RectangleShape shape = new RectangleShape(); -// shape.DrawShape (graphics, -// new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1), -// border); + shape.DrawShape (graphics, + new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1), + rectangle); } } protected RectangleF PrepareRectangle (ReportPageEventArgs rpea,string text) { - SizeF measureSize = new SizeF (); - measureSize = MeasureReportItem (rpea,text); + SizeF measureSize = MeasureReportItem (rpea,text); RectangleF rect = base.DrawingRectangle (rpea,measureSize); return rect; } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs index 36cb6ca0d5..7c1afbcce6 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs @@ -25,11 +25,9 @@ using System.Drawing; namespace SharpReportCore { public class BaseRectangleItem : SharpReportCore.BaseGraphicItem { - private ArrayList arrayList; RectangleShape shape = new RectangleShape(); public BaseRectangleItem() { - arrayList = new ArrayList(); } public override void Render(ReportPageEventArgs rpea) { @@ -39,7 +37,7 @@ namespace SharpReportCore { shape.FillShape(rpea.PrintPageEventArgs.Graphics, new SolidFillPattern(this.BackColor), rect); - + shape.DrawShape (rpea.PrintPageEventArgs.Graphics, new BaseLine (this.ForeColor,base.DashStyle,base.Thickness), rect); diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs index 859a45318a..91e9570ebc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs @@ -9,6 +9,7 @@ using System; using System.Drawing; +using System.Drawing.Drawing2D; using System.ComponentModel; using System.Collections.Generic; using System.Windows.Forms; @@ -25,6 +26,8 @@ namespace SharpReportCore{ private Padding padding; private Color alternateBackColor; private int changeBackColorEveryNRow; + private RectangleShape shape = new RectangleShape(); + public RowItem():this (String.Empty){ } @@ -41,16 +44,7 @@ namespace SharpReportCore{ } #region overrides - private void Decorate (ReportPageEventArgs rpea,Rectangle border) { - using (SolidBrush brush = new SolidBrush(base.BackColor)) { - rpea.PrintPageEventArgs.Graphics.FillRectangle(brush,border); - } - if (base.DrawBorder == true) { - using (Pen pen = new Pen(Color.Black, 1)) { - rpea.PrintPageEventArgs.Graphics.DrawRectangle (pen,border); - } - } - } + protected RectangleF PrepareRectangle (ReportPageEventArgs e) { SizeF measureSize = new SizeF ((SizeF)this.Size); @@ -65,11 +59,20 @@ namespace SharpReportCore{ throw new ArgumentNullException("rpea"); } System.Console.WriteLine(""); - System.Console.WriteLine("--Start Row Item"); + System.Console.WriteLine("--Start of {0}",this.ToString()); base.Render(rpea); RectangleF rect = PrepareRectangle (rpea); - Decorate (rpea,System.Drawing.Rectangle.Ceiling (rect)); + shape.FillShape(rpea.PrintPageEventArgs.Graphics, + new SolidFillPattern(this.BackColor), + rect); + + if (base.DrawBorder == true) { + shape.DrawShape (rpea.PrintPageEventArgs.Graphics, + new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1), + rect); + } + foreach (BaseReportItem childItem in this.items) { Point loc = new Point (childItem.Location.X,childItem.Location.Y); @@ -86,7 +89,7 @@ namespace SharpReportCore{ } public override string ToString(){ - return "RowItem"; + return this.GetType().Name; } #endregion diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseLine.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseLine.cs index 08d0cdc01e..bafc149c61 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseLine.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseLine.cs @@ -31,7 +31,7 @@ using System.Drawing.Drawing2D; /// created by - Forstmeier Peter /// created on - 09.10.2005 18:37:51 /// -namespace SharpReportCore { +namespace SharpReportCore { public class BaseLine : object { DashStyle dashStyle; @@ -45,10 +45,51 @@ namespace SharpReportCore { this.thickness = thickness; } - public void CreatePen () { - throw new NotImplementedException("BaseLine:CreatePen"); - } + public Pen CreatePen(){ + return this.CreatePen(72f); + } + + + public Pen CreatePen(float resolution) + { + Pen pen; + + if (this.thickness == 0f) + { + pen = new Pen(this.color, resolution / 72f); + } + else + { + pen = new Pen(this.color, (this.thickness * resolution) / 72f); + } + + switch (this.dashStyle){ + case DashStyle.Dot: + { + pen.DashStyle = DashStyle.Dot; + return pen; + } + case DashStyle.Dash: + { + pen.DashStyle = DashStyle.Dash; + return pen; + } + case DashStyle.DashDot: + { + pen.DashStyle = DashStyle.DashDot; + return pen; + } + case DashStyle.DashDotDot: + { + pen.DashStyle = DashStyle.DashDotDot; + return pen; + } + } + return pen; + } + + public Color Color { get { return color; diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs index d4df64c061..e4ed6a94a5 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs @@ -31,33 +31,47 @@ using System.Drawing.Drawing2D; /// namespace SharpReportCore { - public class BaseShape : object { + public abstract class BaseShape : object { public BaseShape() { } - public virtual void DrawShape (Graphics graphics,BaseLine baseLine,RectangleF rectangle) { + public void FillShape (Graphics graphics, Brush brush,RectangleF rectangle) { - } + GraphicsPath path1 = this.CreatePath(rectangle); + graphics.FillPath(brush, path1); - - public virtual void DrawShape (Graphics graphics,Pen pen,RectangleF rectangle) { + } + public void FillShape (Graphics graphics,AbstractFillPattern fillPattern,RectangleF rectangle) { + if (fillPattern != null){ + using (Brush brush = fillPattern.CreateBrush(rectangle)){ + if (brush != null){ + this.FillShape(graphics, brush, rectangle); + } + } + } } + public abstract GraphicsPath CreatePath (RectangleF rectangle) ; - public virtual void FillShape (Graphics graphics, Brush brush,RectangleF rectangle) { - - } - public virtual void FillShape (Graphics graphics,AbstractFillPattern fillPattern,RectangleF rectangle) { - - } - public virtual GraphicsPath CreatePath (RectangleF rectangleF) { - return null; + public void DrawShape(Graphics g, BaseLine line, RectangleF rectangle){ + using (Pen pen = line.CreatePen()){ + if (pen != null){ + this.new_DrawShape(g, pen, rectangle); + } + } + } + + public void new_DrawShape(Graphics g, Pen pen, RectangleF rectangle){ + GraphicsPath path1 = this.CreatePath(rectangle); + g.DrawPath(pen, path1); } + + } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/EllipseShape.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/EllipseShape.cs index 0d03939d91..4f31ce9fed 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/EllipseShape.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/EllipseShape.cs @@ -20,6 +20,8 @@ // Peter Forstmeier (Peter.Forstmeier@t-online.de) using System; using System.Drawing; +using System.Drawing.Drawing2D; + /// /// This class draws a Ellipse/Ellipse /// @@ -37,19 +39,10 @@ namespace SharpReportCore { } - public override void DrawShape(Graphics graphics, BaseLine baseLine, RectangleF rectangle) { - base.DrawShape(graphics,baseLine,rectangle); - using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) { - p.DashStyle = baseLine.DashStyle; - graphics.DrawEllipse(p, - rectangle); - } - } - - - public override void FillShape(Graphics graphics, AbstractFillPattern fillPattern, RectangleF rectangle) { - graphics.FillEllipse(fillPattern.Brush, - rectangle); + public override GraphicsPath CreatePath(RectangleF rectangle){ + GraphicsPath path = new GraphicsPath(); + path.AddEllipse(rectangle); + return path; } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs index 11a61702e3..f0550d4b02 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs @@ -39,7 +39,8 @@ namespace SharpReportCore { } - + public abstract Brush CreateBrush(RectangleF rect); + protected Color Color { get { return color; @@ -64,7 +65,12 @@ namespace SharpReportCore { /// public class SolidFillPattern : AbstractFillPattern { public SolidFillPattern (Color color) :base(color){ - base.Brush = new SolidBrush(color); +// base.Brush = new SolidBrush(color); } + + public override Brush CreateBrush(RectangleF rect){ + return new SolidBrush(this.Color); + } + } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/LineShape.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/LineShape.cs index bbdd5b744b..fe8579a3fc 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/LineShape.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/LineShape.cs @@ -20,7 +20,7 @@ // Peter Forstmeier (Peter.Forstmeier@t-online.de) using System; using System.Drawing; - +using System.Drawing.Drawing2D; /// /// Draw a Line, used by DesingerControls and printing stuff @@ -37,21 +37,13 @@ namespace SharpReportCore { /// public LineShape() { } + + public override GraphicsPath CreatePath(RectangleF rectangle){ + GraphicsPath path = new GraphicsPath(); + float halfRect = rectangle.Top + (rectangle.Height /2); + path.AddLine(rectangle.Left, halfRect, rectangle.Right, halfRect); + return path; - public override void DrawShape(Graphics graphics, BaseLine baseLine, RectangleF rectangle) { - base.DrawShape(graphics,baseLine,rectangle); - using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) { - p.DashStyle = baseLine.DashStyle; - float halfRect = rectangle.Top + (rectangle.Height / 2); - - graphics.DrawLine (p, - rectangle.X, - halfRect, - rectangle.X + rectangle.Width, - halfRect); - } } - - } } diff --git a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs index d8cace4837..7f79fc5f84 100644 --- a/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs +++ b/src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs @@ -20,6 +20,7 @@ // Peter Forstmeier (Peter.Forstmeier@t-online.de) using System; using System.Drawing; +using System.Drawing.Drawing2D; /// /// Draw a Rectangle, used by DesingerControls and printing stuff @@ -34,27 +35,13 @@ namespace SharpReportCore { public RectangleShape() { } - - public override void DrawShape(Graphics graphics, BaseLine baseLine, RectangleF rectangle) { - base.DrawShape(graphics,baseLine,rectangle); - using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) { - p.DashStyle = baseLine.DashStyle; - graphics.DrawRectangle (p,rectangle.Left, - rectangle.Top, - rectangle.Width, - rectangle.Height); - } - } - - public override void FillShape(Graphics graphics, AbstractFillPattern fillPattern, RectangleF rectangle) { - graphics.FillRectangle(fillPattern.Brush, - rectangle); - } - public override void FillShape(Graphics graphics, Brush brush, RectangleF rectangle) { - graphics.FillRectangle(brush, rectangle); - + public override GraphicsPath CreatePath(RectangleF rect){ + GraphicsPath path1 = new GraphicsPath(); + path1.AddRectangle(rect); + return path1; } - + + } }