Browse Source

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
shortcuts
Peter Forstmeier 20 years ago
parent
commit
f8a7e02e13
  1. 2
      src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs
  2. 4
      src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs
  3. 2
      src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportLineControl.cs
  4. 6
      src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRectangleControl.cs
  5. 23
      src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs
  6. 19
      src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs
  7. 1
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs
  8. 4
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs
  9. 1
      src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs
  10. 23
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs
  11. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs
  12. 29
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs
  13. 49
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseLine.cs
  14. 40
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs
  15. 19
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/EllipseShape.cs
  16. 10
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs
  17. 22
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/LineShape.cs
  18. 27
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs

2
src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ControlHelper.cs

@ -15,7 +15,7 @@ namespace SharpReport.Designer
/// <summary> /// <summary>
/// Description of ControlHelper. /// Description of ControlHelper.
/// </summary> /// </summary>
internal class ControlHelper{ public class ControlHelper{
Control control; Control control;
public ControlHelper(Control control){ public ControlHelper(Control control){

4
src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportControlBase.cs

@ -129,6 +129,10 @@ namespace SharpReport.Designer{
this.Invalidate(); this.Invalidate();
} }
protected Rectangle FocusRectangle {
get {return this.controlHelper.BuildFocusRectangle;}
}
#region Windows Forms Designer generated code #region Windows Forms Designer generated code
/// <summary> /// <summary>
/// This method is required for Windows Forms designer support. /// This method is required for Windows Forms designer support.

2
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) { protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea) {
base.OnPaint(pea); base.OnPaint(pea);
base.DrawEdges (pea); base.DrawEdges (pea);
base.DrawDecorations(pea); // base.DrawDecorations(pea);
shape.DrawShape(pea.Graphics, shape.DrawShape(pea.Graphics,
new BaseLine (this.ForeColor,base.DashStyle,base.Thickness), new BaseLine (this.ForeColor,base.DashStyle,base.Thickness),

6
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) { protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea) {
base.OnPaint(pea); base.OnPaint(pea);
base.DrawEdges (pea);
base.DrawDecorations(pea); base.DrawDecorations(pea);
shape.FillShape(pea.Graphics, shape.FillShape(pea.Graphics,
new SolidFillPattern(this.BackColor), new SolidFillPattern(this.BackColor),
(RectangleF)this.ClientRectangle); (RectangleF)base.FocusRectangle);
shape.DrawShape (pea.Graphics, shape.DrawShape (pea.Graphics,
new BaseLine (this.ForeColor,base.DashStyle,base.Thickness), new BaseLine (this.ForeColor,base.DashStyle,base.Thickness),
(RectangleF)this.ClientRectangle); (RectangleF)base.FocusRectangle);
} }

23
src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportRowControl.cs

@ -21,7 +21,8 @@ namespace SharpReport.Designer{
/// </summary> /// </summary>
internal class ReportRowControl:ReportControlBase{ internal class ReportRowControl:ReportControlBase{
private RectangleShape shape = new RectangleShape();
private bool drawBorder;
public ReportRowControl():base(){ public ReportRowControl():base(){
InitializeComponent(); InitializeComponent();
this.SetStyle(ControlStyles.DoubleBuffer | this.SetStyle(ControlStyles.DoubleBuffer |
@ -39,10 +40,15 @@ namespace SharpReport.Designer{
#region overrides #region overrides
protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea){ protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea){
base.OnPaint(pea); base.OnPaint(pea);
base.DrawEdges (pea,
Rectangle r = new Rectangle(0,5,this.ClientSize.Width - 1,this.ClientSize.Height - 6); new Rectangle(0,5,this.ClientSize.Width - 1,this.ClientSize.Height - 6) );
base.DrawEdges (pea,r);
base.DrawDecorations(pea); 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(); StringFormat fmt = GlobalValues.StandartStringFormat();
fmt.LineAlignment = StringAlignment.Near; fmt.LineAlignment = StringAlignment.Near;
@ -54,11 +60,18 @@ namespace SharpReport.Designer{
} }
public override string ToString() { public override string ToString() {
return this.Name; return this.GetType().Name;
} }
#endregion #endregion
public bool DrawBorder {
set {
drawBorder = value;
this.Invalidate();
}
}
#region Windows Forms Designer generated code #region Windows Forms Designer generated code
/// <summary> /// <summary>
/// This method is required for Windows Forms designer support. /// This method is required for Windows Forms designer support.

19
src/AddIns/Misc/SharpReport/SharpReport/Designer/VisualControls/ReportTextControl.cs

@ -21,8 +21,10 @@ namespace SharpReport.Designer{
private StringTrimming stringTrimming; private StringTrimming stringTrimming;
private ContentAlignment contentAlignment; private ContentAlignment contentAlignment;
TextDrawer textDrawer = new TextDrawer(); private bool drawBorder;
private TextDrawer textDrawer = new TextDrawer();
private RectangleShape shape = new RectangleShape();
public ReportTextControl():base(){ public ReportTextControl():base(){
InitializeComponent(); InitializeComponent();
@ -36,6 +38,12 @@ namespace SharpReport.Designer{
this.Size = GlobalValues.PreferedSize; 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){ protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea){
base.OnPaint(pea); base.OnPaint(pea);
base.DrawEdges (pea); base.DrawEdges (pea);
base.DrawDecorations(pea); base.DrawDecorations(pea);
@ -74,9 +82,16 @@ namespace SharpReport.Designer{
str = this.Text; 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, this.textDrawer.DrawString (pea.Graphics,this.Text,this.Font,
new SolidBrush(this.ForeColor),(RectangleF)this.ClientRectangle, new SolidBrush(this.ForeColor),(RectangleF)this.ClientRectangle,
this.stringTrimming,this.contentAlignment); this.stringTrimming,this.contentAlignment);
} }

1
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ItemsHelper.cs

@ -53,7 +53,6 @@ namespace SharpReport {
control.Size = item.Size; control.Size = item.Size;
control.Font = item.Font; control.Font = item.Font;
control.Name = item.Name; control.Name = item.Name;
BaseTextItem b = item as BaseTextItem;
} }

4
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportRowItem.cs

@ -108,6 +108,7 @@ namespace SharpReport.ReportItems
private void BasePropertyChange (object sender, PropertyChangedEventArgs e){ private void BasePropertyChange (object sender, PropertyChangedEventArgs e){
ItemsHelper.UpdateControlFromTextBase (this.visualControl,this); ItemsHelper.UpdateControlFromTextBase (this.visualControl,this);
this.visualControl.DrawBorder = base.DrawBorder;
this.HandlePropertyChanged(e.PropertyName); this.HandlePropertyChanged(e.PropertyName);
} }
@ -115,6 +116,7 @@ namespace SharpReport.ReportItems
private void OnControlChanged (object sender, EventArgs e) { private void OnControlChanged (object sender, EventArgs e) {
this.SuspendLayout(); this.SuspendLayout();
ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this); ItemsHelper.UpdateBaseFromTextControl (this.visualControl,this);
this.ResumeLayout(); this.ResumeLayout();
this.HandlePropertyChanged("OnControlChanged"); this.HandlePropertyChanged("OnControlChanged");
@ -206,7 +208,7 @@ namespace SharpReport.ReportItems
} }
public override string ToString(){ public override string ToString(){
return this.Name; return this.GetType().Name;
} }
#endregion #endregion

1
src/AddIns/Misc/SharpReport/SharpReport/ReportItems/TextBased/ReportTextItem.cs

@ -57,6 +57,7 @@ namespace SharpReport.ReportItems {
this.visualControl.ContentAlignment = base.ContentAlignment; this.visualControl.ContentAlignment = base.ContentAlignment;
this.visualControl.StringTrimming = base.StringTrimming; this.visualControl.StringTrimming = base.StringTrimming;
this.visualControl.DrawBorder = base.DrawBorder;
this.HandlePropertyChanged(e.PropertyName); this.HandlePropertyChanged(e.PropertyName);
} }

23
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/BaseTextItem.cs

@ -30,6 +30,7 @@ namespace SharpReportCore {
private StringTrimming stringTrimming; private StringTrimming stringTrimming;
private TextDrawer textDrawer = new TextDrawer(); private TextDrawer textDrawer = new TextDrawer();
private ContentAlignment contentAlignment; private ContentAlignment contentAlignment;
private RectangleShape shape = new RectangleShape();
#region Constructor #region Constructor
@ -63,27 +64,21 @@ namespace SharpReportCore {
} }
protected void FillBackGround (Graphics graphics,RectangleF rectangle) { protected void FillBackGround (Graphics graphics,RectangleF rectangle) {
using (SolidBrush brush = new SolidBrush(base.BackColor)) { shape.FillShape(graphics,
graphics.FillRectangle(brush,rectangle); new SolidFillPattern(this.BackColor),
} rectangle);
} }
protected void DrawFrame (Graphics graphics,Rectangle border) { protected void DrawFrame (Graphics graphics,Rectangle rectangle) {
if (base.DrawBorder == true) { if (base.DrawBorder == true) {
using (Pen pen = new Pen(Color.Black, 1)) { shape.DrawShape (graphics,
graphics.DrawRectangle (pen,border); new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1),
} rectangle);
//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);
} }
} }
protected RectangleF PrepareRectangle (ReportPageEventArgs rpea,string text) { protected RectangleF PrepareRectangle (ReportPageEventArgs rpea,string text) {
SizeF measureSize = new SizeF (); SizeF measureSize = MeasureReportItem (rpea,text);
measureSize = MeasureReportItem (rpea,text);
RectangleF rect = base.DrawingRectangle (rpea,measureSize); RectangleF rect = base.DrawingRectangle (rpea,measureSize);
return rect; return rect;
} }

4
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/Graphics/BaseRectangleItem.cs

@ -25,11 +25,9 @@ using System.Drawing;
namespace SharpReportCore { namespace SharpReportCore {
public class BaseRectangleItem : SharpReportCore.BaseGraphicItem { public class BaseRectangleItem : SharpReportCore.BaseGraphicItem {
private ArrayList arrayList;
RectangleShape shape = new RectangleShape(); RectangleShape shape = new RectangleShape();
public BaseRectangleItem() { public BaseRectangleItem() {
arrayList = new ArrayList();
} }
public override void Render(ReportPageEventArgs rpea) { public override void Render(ReportPageEventArgs rpea) {
@ -39,7 +37,7 @@ namespace SharpReportCore {
shape.FillShape(rpea.PrintPageEventArgs.Graphics, shape.FillShape(rpea.PrintPageEventArgs.Graphics,
new SolidFillPattern(this.BackColor), new SolidFillPattern(this.BackColor),
rect); rect);
shape.DrawShape (rpea.PrintPageEventArgs.Graphics, shape.DrawShape (rpea.PrintPageEventArgs.Graphics,
new BaseLine (this.ForeColor,base.DashStyle,base.Thickness), new BaseLine (this.ForeColor,base.DashStyle,base.Thickness),
rect); rect);

29
src/AddIns/Misc/SharpReport/SharpReportCore/BaseItems/RowItem.cs

@ -9,6 +9,7 @@
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel; using System.ComponentModel;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
@ -25,6 +26,8 @@ namespace SharpReportCore{
private Padding padding; private Padding padding;
private Color alternateBackColor; private Color alternateBackColor;
private int changeBackColorEveryNRow; private int changeBackColorEveryNRow;
private RectangleShape shape = new RectangleShape();
public RowItem():this (String.Empty){ public RowItem():this (String.Empty){
} }
@ -41,16 +44,7 @@ namespace SharpReportCore{
} }
#region overrides #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) { protected RectangleF PrepareRectangle (ReportPageEventArgs e) {
SizeF measureSize = new SizeF ((SizeF)this.Size); SizeF measureSize = new SizeF ((SizeF)this.Size);
@ -65,11 +59,20 @@ namespace SharpReportCore{
throw new ArgumentNullException("rpea"); throw new ArgumentNullException("rpea");
} }
System.Console.WriteLine(""); System.Console.WriteLine("");
System.Console.WriteLine("--Start Row Item"); System.Console.WriteLine("--Start of {0}",this.ToString());
base.Render(rpea); base.Render(rpea);
RectangleF rect = PrepareRectangle (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) { foreach (BaseReportItem childItem in this.items) {
Point loc = new Point (childItem.Location.X,childItem.Location.Y); Point loc = new Point (childItem.Location.X,childItem.Location.Y);
@ -86,7 +89,7 @@ namespace SharpReportCore{
} }
public override string ToString(){ public override string ToString(){
return "RowItem"; return this.GetType().Name;
} }
#endregion #endregion

49
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseLine.cs

@ -31,7 +31,7 @@ using System.Drawing.Drawing2D;
/// created by - Forstmeier Peter /// created by - Forstmeier Peter
/// created on - 09.10.2005 18:37:51 /// created on - 09.10.2005 18:37:51
/// </remarks> /// </remarks>
namespace SharpReportCore { namespace SharpReportCore {
public class BaseLine : object { public class BaseLine : object {
DashStyle dashStyle; DashStyle dashStyle;
@ -45,10 +45,51 @@ namespace SharpReportCore {
this.thickness = thickness; 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 { public Color Color {
get { get {
return color; return color;

40
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/BaseShape.cs

@ -31,33 +31,47 @@ using System.Drawing.Drawing2D;
/// </remarks> /// </remarks>
namespace SharpReportCore { namespace SharpReportCore {
public class BaseShape : object { public abstract class BaseShape : object {
public BaseShape() { 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) { public void DrawShape(Graphics g, BaseLine line, RectangleF rectangle){
return null; 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);
} }
} }
} }

19
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/EllipseShape.cs

@ -20,6 +20,8 @@
// Peter Forstmeier (Peter.Forstmeier@t-online.de) // Peter Forstmeier (Peter.Forstmeier@t-online.de)
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
/// <summary> /// <summary>
/// This class draws a Ellipse/Ellipse /// This class draws a Ellipse/Ellipse
/// </summary> /// </summary>
@ -37,19 +39,10 @@ namespace SharpReportCore {
} }
public override void DrawShape(Graphics graphics, BaseLine baseLine, RectangleF rectangle) { public override GraphicsPath CreatePath(RectangleF rectangle){
base.DrawShape(graphics,baseLine,rectangle); GraphicsPath path = new GraphicsPath();
using (Pen p = new Pen(baseLine.Color,baseLine.Thickness)) { path.AddEllipse(rectangle);
p.DashStyle = baseLine.DashStyle; return path;
graphics.DrawEllipse(p,
rectangle);
}
}
public override void FillShape(Graphics graphics, AbstractFillPattern fillPattern, RectangleF rectangle) {
graphics.FillEllipse(fillPattern.Brush,
rectangle);
} }
} }

10
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/FillPatterns.cs

@ -39,7 +39,8 @@ namespace SharpReportCore {
} }
public abstract Brush CreateBrush(RectangleF rect);
protected Color Color { protected Color Color {
get { get {
return color; return color;
@ -64,7 +65,12 @@ namespace SharpReportCore {
/// </summary> /// </summary>
public class SolidFillPattern : AbstractFillPattern { public class SolidFillPattern : AbstractFillPattern {
public SolidFillPattern (Color color) :base(color){ 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);
}
} }
} }

22
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/LineShape.cs

@ -20,7 +20,7 @@
// Peter Forstmeier (Peter.Forstmeier@t-online.de) // Peter Forstmeier (Peter.Forstmeier@t-online.de)
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
/// <summary> /// <summary>
/// Draw a Line, used by DesingerControls and printing stuff /// Draw a Line, used by DesingerControls and printing stuff
@ -37,21 +37,13 @@ namespace SharpReportCore {
/// </summary> /// </summary>
public LineShape() { 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);
}
} }
} }
} }

27
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/Graphics/RectangleShape.cs

@ -20,6 +20,7 @@
// Peter Forstmeier (Peter.Forstmeier@t-online.de) // Peter Forstmeier (Peter.Forstmeier@t-online.de)
using System; using System;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D;
/// <summary> /// <summary>
/// Draw a Rectangle, used by DesingerControls and printing stuff /// Draw a Rectangle, used by DesingerControls and printing stuff
@ -34,27 +35,13 @@ namespace SharpReportCore {
public RectangleShape() { 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) { public override GraphicsPath CreatePath(RectangleF rect){
graphics.FillRectangle(brush, rectangle); GraphicsPath path1 = new GraphicsPath();
path1.AddRectangle(rect);
return path1;
} }
} }
} }

Loading…
Cancel
Save