Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 8b59899

Browse files
Rectangle + ContainerDesigner
1 parent faddd08 commit 8b59899

9 files changed

Lines changed: 343 additions & 91 deletions

File tree

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
<ItemGroup>
7777
<Folder Include="Configuration" />
7878
<Folder Include="src" />
79+
<Folder Include="src\DesignableItems\GraphicItems" />
7980
<Folder Include="src\DesignerBinding" />
8081
<Folder Include="src\Commands" />
8182
<Folder Include="src\Designer" />
@@ -93,8 +94,10 @@
9394
<ItemGroup>
9495
<Compile Include="Configuration\AssemblyInfo.cs" />
9596
<Compile Include="src\Commands\ViewCommands.cs" />
97+
<Compile Include="src\DesignableItems\AbstractGraphicItem.cs" />
9698
<Compile Include="src\DesignableItems\AbstractItem.cs" />
9799
<Compile Include="src\DesignableItems\BaseLineItem.cs" />
100+
<Compile Include="src\DesignableItems\BaseRectangleItem.cs" />
98101
<Compile Include="src\DesignableItems\BaseSection.cs" />
99102
<Compile Include="src\DesignableItems\BaseTextItem.cs" />
100103
<Compile Include="src\DesignableItems\BaseDataItem.cs" />
@@ -108,6 +111,7 @@
108111
<Compile Include="src\Designer\AbstractDesigner.cs" />
109112
<Compile Include="src\Designer\DataItemDesigner.cs" />
110113
<Compile Include="src\Designer\LineDesigner.cs" />
114+
<Compile Include="src\Designer\ContainerDesigner.cs" />
111115
<Compile Include="src\Designer\ReportRootDesigner.cs" />
112116
<Compile Include="src\Designer\ReportSettingsDesigner.cs" />
113117
<Compile Include="src\Designer\RootReportModel.cs" />
@@ -133,6 +137,7 @@
133137
<Compile Include="src\TypeProvider\AbstractItemTypeProvider.cs" />
134138
<Compile Include="src\TypeProvider\DataItemTypeProvider.cs" />
135139
<Compile Include="src\TypeProvider\LineItemTypeProvider.cs" />
140+
<Compile Include="src\TypeProvider\RectangleItemTypeProvider.cs" />
136141
<Compile Include="src\TypeProvider\SectionItemTypeProvider.cs" />
137142
<Compile Include="src\TypeProvider\TextItemTypeProvider.cs" />
138143
<Compile Include="src\TypeProvider\TypeProviderHelper.cs" />
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Created by SharpDevelop.
3+
* User: Peter Forstmeier
4+
* Date: 05.04.2014
5+
* Time: 17:26
6+
*
7+
* To change this template use Tools | Options | Coding | Edit Standard Headers.
8+
*/
9+
using System;
10+
using System.ComponentModel;
11+
using System.Drawing.Drawing2D;
12+
13+
namespace ICSharpCode.Reporting.Addin.DesignableItems
14+
{
15+
/// <summary>
16+
/// Description of AbstractGraphicItem.
17+
/// </summary>
18+
public class AbstractGraphicItem:AbstractItem
19+
{
20+
21+
float thickness;
22+
DashStyle dashStyle;
23+
24+
25+
public AbstractGraphicItem()
26+
{
27+
Thickness = 1;
28+
DashStyle = DashStyle.Solid;
29+
}
30+
31+
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
32+
{
33+
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
34+
base.OnPaint(e);
35+
Draw(e.Graphics);
36+
}
37+
38+
public override void Draw(System.Drawing.Graphics graphics)
39+
{
40+
41+
}
42+
43+
[Category("Appearance")]
44+
public DashStyle DashStyle {
45+
get { return dashStyle; }
46+
set {
47+
dashStyle = value;
48+
Invalidate();
49+
}
50+
}
51+
52+
53+
[Category("Appearance")]
54+
public float Thickness {
55+
get { return thickness; }
56+
set {
57+
thickness = value;
58+
Invalidate();
59+
}
60+
}
61+
}
62+
}

src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/BaseLineItem.cs

Lines changed: 22 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,23 @@
1616
namespace ICSharpCode.Reporting.Addin.DesignableItems
1717
{
1818
[Designer(typeof(LineDesigner))]
19-
public class BaseLineItem:AbstractItem
19+
public class BaseLineItem:AbstractGraphicItem
2020
{
2121
Point fromPoint;
2222
Point toPoint;
2323
LineCap startLineCap;
2424
LineCap endLineCap;
2525
DashCap dashLineCap;
26-
DashStyle dashStyle;
27-
float thickness;
2826

27+
2928
public BaseLineItem()
3029
{
31-
this.thickness = 1;
32-
this.dashStyle = DashStyle.Solid;
3330
this.Size = new Size(50,10);
3431
TypeDescriptor.AddProvider(new LineItemTypeProvider(), typeof(BaseLineItem));
3532
this.SetStartEndPoint();
3633
}
3734

35+
3836
void SetStartEndPoint ()
3937
{
4038
fromPoint = new Point(ClientRectangle.Left + 10,ClientRectangle.Height / 2);
@@ -59,9 +57,9 @@ public override void Draw(Graphics graphics)
5957
if (graphics == null) {
6058
throw new ArgumentNullException("graphics");
6159
}
62-
using (Pen p = new Pen(this.ForeColor,this.Thickness)) {
63-
p.SetLineCap(this.StartLineCap,this.EndLineCap,this.DashLineCap);
64-
graphics.DrawLine(p,this.fromPoint,this.toPoint);
60+
using (var p = new Pen(ForeColor,Thickness)) {
61+
p.SetLineCap(StartLineCap,EndLineCap,DashLineCap);
62+
graphics.DrawLine(p,fromPoint,toPoint);
6563
}
6664
}
6765

@@ -70,13 +68,13 @@ public Point FromPoint {
7068
get { return fromPoint; }
7169
set {
7270
Point x = value;
73-
if (!this.ClientRectangle.Contains(x)) {
74-
this.fromPoint = new Point(x.X - this.Location.X,
75-
x.Y - this.Location.Y);
71+
if (!ClientRectangle.Contains(x)) {
72+
fromPoint = new Point(x.X - Location.X,x.Y - Location.Y);
73+
7674
} else {
77-
this.fromPoint = x;
75+
fromPoint = x;
7876
}
79-
this.Invalidate();
77+
Invalidate();
8078
}
8179
}
8280

@@ -86,8 +84,8 @@ public Point ToPoint {
8684
set {
8785
Point x = value;
8886
if (!ClientRectangle.Contains(x)) {
89-
this.toPoint = new Point(x.X - this.Location.X,
90-
x.Y - this.Location.Y);
87+
toPoint = new Point(x.X - Location.X,x.Y - Location.Y);
88+
9189
}
9290
else {
9391
toPoint = x;
@@ -97,63 +95,34 @@ public Point ToPoint {
9795
}
9896

9997

100-
101-
// [Browsable(true),
102-
// Category("Appearance"),
103-
// Description("LineStyle")]
104-
public DashStyle DashStyle {
105-
get { return dashStyle; }
106-
set {
107-
dashStyle = value;
108-
this.Invalidate();
109-
}
110-
}
111-
112-
113-
// [Browsable(true),
114-
// Category("Appearance"),
115-
// Description("Thickness of Line")]
116-
public float Thickness {
117-
get { return thickness; }
118-
set {
119-
thickness = value;
120-
this.Invalidate();
121-
}
122-
}
123-
124-
// [Browsable(true),
125-
// Category("Appearance"),
126-
// Description("LineCap at Startposition")]
98+
[ Category("Appearance")]
12799
public LineCap StartLineCap {
128100
get { return startLineCap; }
129101
set {
130102
startLineCap = value;
131-
this.Invalidate();
103+
Invalidate();
132104
}
133105
}
134106

135-
// [Browsable(true),
136-
// Category("Appearance"),
137-
// Description("Linecap at Endposition")]
107+
108+
[ Category("Appearance")]
138109
public LineCap EndLineCap {
139110
get { return endLineCap; }
140111
set {
141112
endLineCap = value;
142-
this.Invalidate();
113+
Invalidate();
143114
}
144115
}
145116

146-
// [Browsable(true),
147-
// Category("Appearance"),
148-
// Description("Dashlinecap")]
117+
118+
[Category("Appearance")]
149119
public DashCap DashLineCap {
150120
get { return dashLineCap; }
151121
set {
152122
dashLineCap = value;
153-
this.Invalidate();
123+
Invalidate();
154124
}
155125
}
156-
157-
}
158126

127+
}
159128
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Created by SharpDevelop.
3+
* User: Peter Forstmeier
4+
* Date: 05.04.2014
5+
* Time: 17:23
6+
*
7+
* To change this template use Tools | Options | Coding | Edit Standard Headers.
8+
*/
9+
using System;
10+
using System.ComponentModel;
11+
using System.Drawing;
12+
using ICSharpCode.Reporting.Addin.DesignableItems;
13+
using ICSharpCode.Reporting.Addin.Designer;
14+
using ICSharpCode.Reporting.Addin.TypeProvider;
15+
16+
namespace ICSharpCode.Reporting.Addin.DesignableItems
17+
{
18+
/// <summary>
19+
/// Description of BaseRectangleItem.
20+
/// </summary>
21+
///
22+
[Designer(typeof(ContainerDesigner))]
23+
class BaseRectangleItem:AbstractGraphicItem
24+
{
25+
public BaseRectangleItem()
26+
{
27+
TypeDescriptor.AddProvider(new RectangleItemTypeProvider(), typeof(BaseRectangleItem));
28+
}
29+
30+
public override void Draw(Graphics graphics)
31+
{
32+
if (graphics == null) {
33+
throw new ArgumentNullException("graphics");
34+
}
35+
36+
var rect = new Rectangle(ClientRectangle.Left,
37+
ClientRectangle.Top,
38+
ClientRectangle.Right -1,
39+
ClientRectangle.Bottom -1);
40+
41+
using (var pen = new Pen(ForeColor,Thickness)) {
42+
graphics.DrawRectangle(pen,rect);
43+
}
44+
45+
46+
// backgroundShape.FillShape(graphics,
47+
// new SolidFillPattern(this.BackColor),
48+
// rect);
49+
50+
// Border b = new Border(new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1));
51+
// DrawFrame(graphics,b);
52+
// BaseLine line = new BaseLine(base.ForeColor,DashStyle,Thickness,LineCap.Round,LineCap.Round,DashCap.Round);
53+
// using (Pen pen = line.CreatePen(line.Thickness)){
54+
// shape.CornerRadius = this.CornerRadius;
55+
// GraphicsPath path1 = shape.CreatePath(rect);
56+
// graphics.DrawPath(pen, path1);
57+
//
58+
// }
59+
60+
// shape.DrawShape (graphics,
61+
// this.Baseline(),
62+
// rect);
63+
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)