Browse Source

Designer can draw Sections

reports
Peter Forstmeier 11 years ago
parent
commit
8b6c86da80
  1. 1
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj
  2. 20
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/AbstractItem.cs
  3. 5
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/BaseSection.cs
  4. 8
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/ReportRootDesigner.cs
  5. 39
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/RootReportModel.cs
  6. 1
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/SectionDesigner.cs
  7. 67
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/AbstractItemTypeProvider.cs
  8. 2
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/SectionItemTypeProvider.cs
  9. 8
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Views/DesignerView.cs

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

@ -103,6 +103,7 @@ @@ -103,6 +103,7 @@
<Compile Include="src\Services\HelpService.cs" />
<Compile Include="src\Services\ToolboxService.cs" />
<Compile Include="src\Services\UIService.cs" />
<Compile Include="src\TypeProvider\AbstractItemTypeProvider.cs" />
<Compile Include="src\TypeProvider\SectionItemTypeProvider.cs" />
<Compile Include="src\TypeProvider\TypeProviderHelper.cs" />
<Compile Include="src\Views\DesignerView.cs" />

20
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/AbstractItem.cs

@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
using System;
using System.ComponentModel;
using System.Drawing;
using ICSharpCode.Reporting.Addin.TypeProvider;
namespace ICSharpCode.Reporting.Addin.DesignableItems
{
@ -24,8 +25,7 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems @@ -24,8 +25,7 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems
protected AbstractItem()
{
InitializeComponent();
// TypeDescriptor.AddProvider(new AbstractItemTypeProvider(), typeof(AbstractItem));
// VisibleInReport = true;
TypeDescriptor.AddProvider(new AbstractItemTypeProvider(), typeof(AbstractItem));
}
@ -45,9 +45,9 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems @@ -45,9 +45,9 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems
get {
return new Rectangle(this.ClientRectangle.Left ,
this.ClientRectangle.Top ,
this.ClientRectangle.Width -1,
this.ClientRectangle.Height -1);
ClientRectangle.Top ,
ClientRectangle.Width -1,
ClientRectangle.Height -1);
}
}
@ -68,22 +68,16 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems @@ -68,22 +68,16 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems
protected new Size DefaultSize {get;set;}
// public bool VisibleInReport {get;set;}
#endregion
[System.ComponentModel.EditorBrowsableAttribute()]
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
base.OnPaint(e);
}
public abstract void Draw(Graphics graphics);
private void InitializeComponent()
{
this.SuspendLayout();
this.ResumeLayout(false);
SuspendLayout();
ResumeLayout(false);
}
}
}

5
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/BaseSection.cs

@ -23,14 +23,15 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems @@ -23,14 +23,15 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems
public BaseSection():base()
{
base.FrameColor = Color.Black;
FrameColor = Color.Black;
TypeDescriptor.AddProvider(new SectionItemTypeProvider(), typeof(BaseSection));
}
[EditorBrowsableAttribute()]
// [EditorBrowsableAttribute()]
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
Console.WriteLine("BaseSection:OnPaint");
base.OnPaint(e);
Draw(e.Graphics);
}

8
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/ReportRootDesigner.cs

@ -49,12 +49,6 @@ namespace ICSharpCode.Reporting.Addin.Designer @@ -49,12 +49,6 @@ namespace ICSharpCode.Reporting.Addin.Designer
ICSharpCode.Reporting.Items.ReportSettings reportSettings;
RootReportModel rootReportModel;
public ReportRootDesigner()
{
Console.WriteLine("Create RootDesigner");
// Control.BackColor = Color.Chocolate;
}
void ShowMessage(Exception e)
{
@ -234,7 +228,7 @@ namespace ICSharpCode.Reporting.Addin.Designer @@ -234,7 +228,7 @@ namespace ICSharpCode.Reporting.Addin.Designer
// this.host.Container.Add(cc);
// }
//
// this.Control.Controls.Add(section);
this.Control.Controls.Add(section);
RecalculateSections();
}
}

39
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/RootReportModel.cs

@ -11,7 +11,6 @@ using System.ComponentModel; @@ -11,7 +11,6 @@ using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Drawing.Printing;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reporting.Addin.Globals;
namespace ICSharpCode.Reporting.Addin.Designer
@ -24,21 +23,13 @@ namespace ICSharpCode.Reporting.Addin.Designer @@ -24,21 +23,13 @@ namespace ICSharpCode.Reporting.Addin.Designer
public class RootReportModel:RootDesignedComponent
{
bool showDebugFrame;
public RootReportModel(){
Console.WriteLine("create RootReportModel");
}
[EditorBrowsableAttribute()]
protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea)
{
Console.WriteLine("RootReportModel:Onpaint : {0}",this.BackColor);
base.OnPaint(pea);
if (this.showDebugFrame) {
PrintMargin(pea.Graphics);
}
using (Font font = DesignerGlobals.DesignerFont) {
foreach(System.Windows.Forms.Control ctrl in this.Controls)
{
@ -50,34 +41,6 @@ namespace ICSharpCode.Reporting.Addin.Designer @@ -50,34 +41,6 @@ namespace ICSharpCode.Reporting.Addin.Designer
}
}
public void Toggle ()
{
showDebugFrame = !this.showDebugFrame;
Invalidate(true);
}
private void PrintMargin( Graphics graphics)
{
string s = String.Format(System.Globalization.CultureInfo.CurrentCulture,
"[Size : {0}] [Landscape : {1}] [Bounds : {2}]",
this.Page,this.Landscape,this.PageMargin);
using (Font font = DesignerGlobals.DesignerFont){
SizeF size = graphics.MeasureString(s,font);
graphics.DrawString(s,font,
new SolidBrush(Color.LightGray),
new Rectangle(this.PageMargin.Left + 100,
this.PageMargin.Top - (int)font.GetHeight() - 3,
(int)size.Width,
(int)size.Height));
var rectangle = new Rectangle(this.PageMargin.Left - 2,this.PageMargin.Top - 2,
this.Page.Width - this.PageMargin.Left - this.PageMargin.Right + 2,
this.Size.Height - this.PageMargin.Top - this.PageMargin.Bottom + 2);
graphics.DrawRectangle(new Pen(Color.LightGray,1),rectangle);
}
}
public Margins PageMargin {get;set;}
public Rectangle Page {get;set;}

1
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/SectionDesigner.cs

@ -48,6 +48,7 @@ namespace ICSharpCode.Reporting.Addin.Designer @@ -48,6 +48,7 @@ namespace ICSharpCode.Reporting.Addin.Designer
protected override void OnPaintAdornments(PaintEventArgs pe)
{
Console.WriteLine("SectionDesigner:OnPaintAdornments");
base.OnPaintAdornments(pe);
}

67
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/AbstractItemTypeProvider.cs

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 18.03.2014
* Time: 20:05
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using ICSharpCode.Reporting.Addin.DesignableItems;
namespace ICSharpCode.Reporting.Addin.TypeProvider
{
/// <summary>
/// Description of AbstractItemTypeProvider.
/// </summary>
class AbstractItemTypeProvider : TypeDescriptionProvider {
public AbstractItemTypeProvider() : base(TypeDescriptor.GetProvider(typeof(AbstractItem)))
{
}
public AbstractItemTypeProvider(TypeDescriptionProvider parent): base(parent)
{
}
public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
{
ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType, instance);
return new AbstractItemTypeDescriptor(td, instance);
}
}
internal class AbstractItemTypeDescriptor : CustomTypeDescriptor
{
// private AbstractItem _instance;
public AbstractItemTypeDescriptor(ICustomTypeDescriptor parent, object instance)
: base(parent)
{
// _instance = instance as AbstractItem;
}
public override PropertyDescriptorCollection GetProperties()
{
return GetProperties(null);
}
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
PropertyDescriptorCollection props = base.GetProperties(attributes);
List<PropertyDescriptor> allProperties = new List<PropertyDescriptor>();
foreach (PropertyDescriptor p in props)
{
allProperties.Add(p);
}
return new PropertyDescriptorCollection(allProperties.ToArray());
}
}
}

2
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/SectionItemTypeProvider.cs

@ -16,7 +16,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider @@ -16,7 +16,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider
/// <summary>
/// Description of SectionItemTypeProvider.
/// </summary>
internal class SectionItemTypeProvider : TypeDescriptionProvider
class SectionItemTypeProvider : TypeDescriptionProvider
{
public SectionItemTypeProvider() : base(TypeDescriptor.GetProvider(typeof(AbstractItem)))
{

8
src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Views/DesignerView.cs

@ -333,11 +333,9 @@ namespace ICSharpCode.Reporting.Addin.Views @@ -333,11 +333,9 @@ namespace ICSharpCode.Reporting.Addin.Views
void SetupDesignSurface()
{
// Control c = null;
var c = designSurface.View as Control;
c.BackColor = System.Drawing.Color.Green;
c.Parent = panel;
c.Dock = DockStyle.Fill;
var ctrl = designSurface.View as Control;
ctrl.Parent = panel;
ctrl.Dock = DockStyle.Fill;
}

Loading…
Cancel
Save