Browse Source

Small changes in Designer

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1328 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 20 years ago
parent
commit
fed2092fc3
  1. 10
      src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs
  2. 99
      src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs
  3. 1
      src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportDisplayBinding.cs
  4. 18
      src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs

10
src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/BaseDesignerControl.cs

@ -17,8 +17,7 @@ using SharpReportCore;
namespace SharpReport.Designer namespace SharpReport.Designer{
{
/// <summary> /// <summary>
/// Description of BaseDesignerControl. /// Description of BaseDesignerControl.
/// </summary> /// </summary>
@ -26,17 +25,12 @@ namespace SharpReport.Designer
{ {
private SharpReport.Designer.Report reportControl; private SharpReport.Designer.Report reportControl;
private Ruler.ctrlRuler ctrlRuler1; private Ruler.ctrlRuler ctrlRuler1;
private System.Drawing.GraphicsUnit graphicsUnit; private System.Drawing.GraphicsUnit graphicsUnit;
private ReportModel reportModel; private ReportModel reportModel;
public event PropertyChangedEventHandler DesignerDirty; public event PropertyChangedEventHandler DesignerDirty;
public BaseDesignerControl(){
public BaseDesignerControl()
{
InitializeComponent(); InitializeComponent();
this.SetStyle(ControlStyles.DoubleBuffer | this.SetStyle(ControlStyles.DoubleBuffer |

99
src/AddIns/Misc/SharpReport/SharpReport/Designer/SectionControls/ReportSectionControlbase.cs

@ -16,15 +16,13 @@ using System.ComponentModel;
using SharpReportCore; using SharpReportCore;
using SharpReport.ReportItems; using SharpReport.ReportItems;
/// <summary>
/// BaseControl for <see cref="ReportSection"></see>
/// </summary>
///
namespace SharpReport.Designer{ namespace SharpReport.Designer{
/// <summary> public abstract class ReportSectionControlBase :ReportObjectControlBase{
/// BaseControl for <see cref="ReportSection"></see>
/// </summary>
///
public abstract class ReportSectionControlBase :ReportObjectControlBase
{
private System.Windows.Forms.Label titleLabel;
private System.Windows.Forms.Panel titlePanel; private System.Windows.Forms.Panel titlePanel;
private System.Windows.Forms.Panel splitPanel; private System.Windows.Forms.Panel splitPanel;
private Ruler.ctrlRuler ctrlRuler1; private Ruler.ctrlRuler ctrlRuler1;
@ -40,12 +38,10 @@ namespace SharpReport.Designer{
private BaseReportItem draggedItem; private BaseReportItem draggedItem;
public event EventHandler <EventArgs> ItemSelected; public event EventHandler <EventArgs> ItemSelected;
public event ItemDragDropEventHandler ItemDragDrop; public event ItemDragDropEventHandler ItemDragDrop;
public event EventHandler <SectionChangedEventArgs> SectionChanged; public event EventHandler <SectionChangedEventArgs> SectionChanged;
internal ReportSectionControlBase() internal ReportSectionControlBase(){
{
InitializeComponent(); InitializeComponent();
this.SetStyle(ControlStyles.DoubleBuffer | this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint | ControlStyles.UserPaint |
@ -57,11 +53,6 @@ namespace SharpReport.Designer{
this.designableFactory = new IDesignableFactory(); this.designableFactory = new IDesignableFactory();
} }
void ReportSectionLoad(object sender, System.EventArgs e){
titleLabel.Text = this.GetType().Name;
}
void BodyPanelSizeChanged(object sender, System.EventArgs e){ void BodyPanelSizeChanged(object sender, System.EventArgs e){
this.Size = new Size (this.Size.Width,this.bodyPanel.Height + this.titlePanel.Height + this.splitPanel.Height); this.Size = new Size (this.Size.Width,this.bodyPanel.Height + this.titlePanel.Height + this.splitPanel.Height);
} }
@ -76,14 +67,13 @@ namespace SharpReport.Designer{
} }
private void OnPaintTitel(object sender, PaintEventArgs pea) {
private void TitelLabelPaint(object sender, PaintEventArgs pea) {
pea.Graphics.Clear (this.BackColor); pea.Graphics.Clear (this.BackColor);
using (Brush brush = new SolidBrush(Color.Black)) { using (Brush brush = new SolidBrush(Color.Black)) {
pea.Graphics.DrawString (caption, pea.Graphics.DrawString (caption,
this.Font, this.Font,
brush, brush,
new PointF(0,0)); new PointF(this.bodyPanel.Location.X,0));
} }
} }
@ -106,25 +96,19 @@ namespace SharpReport.Designer{
#region propertys #region propertys
public override Control Body public override Control Body{
{
get { return bodyPanel; } get { return bodyPanel; }
} }
public Control Head public Control Head{
{
get { get {
return this.titlePanel; return this.titlePanel;
} }
} }
public string Caption { public string Caption {
get {
return caption;
}
set { set {
caption = value; caption = value;
this.titleLabel.Text = caption;
} }
} }
@ -147,23 +131,9 @@ namespace SharpReport.Designer{
#endregion #endregion
#region overrides
protected override void OnPaint(System.Windows.Forms.PaintEventArgs pea)
{
base.OnPaint(pea);
using (Pen p = new Pen(Color.Gray,5)){
pea.Graphics.DrawRectangle(p, 0, 0, this.Width - 1, this.Height - 1);
}
}
protected override void OnResize (EventArgs e) { #region DragDrop
base.OnResize (e);
}
#endregion
#region dragdrop
private string DragObjectToString (DragEventArgs dea) { private string DragObjectToString (DragEventArgs dea) {
if (dea.Data.GetDataPresent(typeof(System.String))){ if (dea.Data.GetDataPresent(typeof(System.String))){
return Convert.ToString (dea.Data.GetData(typeof(System.String)), return Convert.ToString (dea.Data.GetData(typeof(System.String)),
@ -243,7 +213,7 @@ namespace SharpReport.Designer{
if (r.Contains(c.PointToClient(point))) { if (r.Contains(c.PointToClient(point))) {
IContainerItem ia = c as IContainerItem; IContainerItem ia = c as IContainerItem;
return ia; return ia;
} }
} }
return null; return null;
} }
@ -262,7 +232,6 @@ namespace SharpReport.Designer{
this.ctrlRuler1 = new Ruler.ctrlRuler(); this.ctrlRuler1 = new Ruler.ctrlRuler();
this.splitPanel = new System.Windows.Forms.Panel(); this.splitPanel = new System.Windows.Forms.Panel();
this.titlePanel = new System.Windows.Forms.Panel(); this.titlePanel = new System.Windows.Forms.Panel();
this.titleLabel = new System.Windows.Forms.Label();
this.titlePanel.SuspendLayout(); this.titlePanel.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -276,29 +245,31 @@ namespace SharpReport.Designer{
this.bodyPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.bodyPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.bodyPanel.Location = new System.Drawing.Point(24, 20); this.bodyPanel.Location = new System.Drawing.Point(24, 20);
this.bodyPanel.Name = "bodyPanel"; this.bodyPanel.Name = "bodyPanel";
this.bodyPanel.Size = new System.Drawing.Size(408, 129); this.bodyPanel.Size = new System.Drawing.Size(408, 131);
this.bodyPanel.TabIndex = 6; this.bodyPanel.TabIndex = 6;
this.bodyPanel.DragOver += new System.Windows.Forms.DragEventHandler(this.BodyPanelDragOver);
this.bodyPanel.DragDrop += new System.Windows.Forms.DragEventHandler(this.BodyPanelDragDrop);
this.bodyPanel.DragEnter += new System.Windows.Forms.DragEventHandler(this.BodyPanelDragEnter); this.bodyPanel.DragEnter += new System.Windows.Forms.DragEventHandler(this.BodyPanelDragEnter);
this.bodyPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.BodyPanelPaint);
this.bodyPanel.SizeChanged += new System.EventHandler(this.BodyPanelSizeChanged); this.bodyPanel.SizeChanged += new System.EventHandler(this.BodyPanelSizeChanged);
this.bodyPanel.DragLeave += new System.EventHandler(this.BodyPanelDragLeave); this.bodyPanel.DragLeave += new System.EventHandler(this.BodyPanelDragLeave);
this.bodyPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.BodyPanelPaint);
this.bodyPanel.DragDrop += new System.Windows.Forms.DragEventHandler(this.BodyPanelDragDrop);
this.bodyPanel.DragOver += new System.Windows.Forms.DragEventHandler(this.BodyPanelDragOver);
// //
// ctrlRuler1 // ctrlRuler1
// //
this.ctrlRuler1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.ctrlRuler1.BackColor = System.Drawing.SystemColors.Window; this.ctrlRuler1.BackColor = System.Drawing.SystemColors.Window;
this.ctrlRuler1.Direction = Ruler.ctrlRuler.enmDirection.enmVertikal; this.ctrlRuler1.Direction = Ruler.ctrlRuler.enmDirection.enmVertikal;
this.ctrlRuler1.DrawFrame = false; this.ctrlRuler1.DrawFrame = true;
this.ctrlRuler1.EndValue = 210; this.ctrlRuler1.EndValue = 210;
this.ctrlRuler1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.ctrlRuler1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ctrlRuler1.LeftMargin = 0; this.ctrlRuler1.LeftMargin = 0;
this.ctrlRuler1.Location = new System.Drawing.Point(0, 20); this.ctrlRuler1.Location = new System.Drawing.Point(0, 20);
this.ctrlRuler1.MarginColor = System.Drawing.Color.Empty; this.ctrlRuler1.MarginColor = System.Drawing.Color.Empty;
this.ctrlRuler1.Name = "ctrlRuler1"; this.ctrlRuler1.Name = "ctrlRuler1";
this.ctrlRuler1.RightMargin = 0; this.ctrlRuler1.RightMargin = 0;
this.ctrlRuler1.ScaleUnit = System.Drawing.GraphicsUnit.Millimeter; this.ctrlRuler1.ScaleUnit = System.Drawing.GraphicsUnit.Millimeter;
this.ctrlRuler1.Size = new System.Drawing.Size(24, 128); this.ctrlRuler1.Size = new System.Drawing.Size(24, 131);
this.ctrlRuler1.StartValue = 0; this.ctrlRuler1.StartValue = 0;
this.ctrlRuler1.TabIndex = 1; this.ctrlRuler1.TabIndex = 1;
// //
@ -311,45 +282,33 @@ namespace SharpReport.Designer{
this.splitPanel.Name = "splitPanel"; this.splitPanel.Name = "splitPanel";
this.splitPanel.Size = new System.Drawing.Size(432, 4); this.splitPanel.Size = new System.Drawing.Size(432, 4);
this.splitPanel.TabIndex = 7; this.splitPanel.TabIndex = 7;
this.splitPanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SplitPanelMouseUp);
this.splitPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SplitPanelMouseDown); this.splitPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SplitPanelMouseDown);
this.splitPanel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SplitPanelMouseUp);
// //
// titlePanel // titlePanel
// //
this.titlePanel.BackColor = System.Drawing.SystemColors.Control; this.titlePanel.BackColor = System.Drawing.SystemColors.Control;
this.titlePanel.Controls.Add(this.titleLabel);
this.titlePanel.Dock = System.Windows.Forms.DockStyle.Top; this.titlePanel.Dock = System.Windows.Forms.DockStyle.Top;
this.titlePanel.Location = new System.Drawing.Point(0, 0); this.titlePanel.Location = new System.Drawing.Point(0, 0);
this.titlePanel.Name = "titlePanel"; this.titlePanel.Name = "titlePanel";
this.titlePanel.Size = new System.Drawing.Size(432, 20); this.titlePanel.Size = new System.Drawing.Size(432, 20);
this.titlePanel.TabIndex = 5; this.titlePanel.TabIndex = 5;
this.titlePanel.Paint += new System.Windows.Forms.PaintEventHandler(this.OnPaintTitel);
// //
// titleLabel // UserControl1
//
this.titleLabel.Location = new System.Drawing.Point(24, 0);
this.titleLabel.Name = "titleLabel";
this.titleLabel.Size = new System.Drawing.Size(144, 20);
this.titleLabel.TabIndex = 3;
this.titleLabel.Text = "label1";
this.titleLabel.Paint += new System.Windows.Forms.PaintEventHandler(this.TitelLabelPaint);
//
// ReportSectionControlBase
// //
this.BackColor = System.Drawing.SystemColors.Control; this.BackColor = System.Drawing.SystemColors.Control;
this.Controls.Add(this.bodyPanel); this.Controls.Add(this.bodyPanel);
this.Controls.Add(this.titlePanel); this.Controls.Add(this.titlePanel);
this.Controls.Add(this.splitPanel); this.Controls.Add(this.splitPanel);
this.Controls.Add(this.ctrlRuler1); this.Controls.Add(this.ctrlRuler1);
this.Name = "ReportSectionControlBase"; this.Name = "UserControl1";
this.Size = new System.Drawing.Size(432, 154); this.Size = new System.Drawing.Size(432, 154);
this.Load += new System.EventHandler(this.ReportSectionLoad);
this.titlePanel.ResumeLayout(false); this.titlePanel.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion
#endregion
} }
} }

1
src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportDisplayBinding.cs

@ -81,6 +81,7 @@ namespace SharpReportAddin {
view.UpdateView (false); view.UpdateView (false);
view.Selected(); view.Selected();
view.DesignerControl.ReportModel.ReportSettings.InitDone = true; view.DesignerControl.ReportModel.ReportSettings.InitDone = true;
view.RegisterPropertyChangedEvents();
return view; return view;
} catch (Exception) { } catch (Exception) {
return new SharpReportView(); return new SharpReportView();

18
src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs

@ -402,6 +402,7 @@ namespace SharpReportAddin{
/// <summary> /// <summary>
/// Show's Report in PreviewControl /// Show's Report in PreviewControl
/// </summary> /// </summary>
public void OnPreviewClick () { public void OnPreviewClick () {
reportManager.NoData -= new EventHandler<SharpReportEventArgs> (OnNoDataForReport); reportManager.NoData -= new EventHandler<SharpReportEventArgs> (OnNoDataForReport);
reportManager.NoData += new EventHandler<SharpReportEventArgs> (OnNoDataForReport); reportManager.NoData += new EventHandler<SharpReportEventArgs> (OnNoDataForReport);
@ -412,6 +413,10 @@ namespace SharpReportAddin{
this.RunPreview(false); this.RunPreview(false);
} }
/// <summary>
/// Remove the selected Item from <see cref="BaseDesignerControl"></see>
/// </summary>
public void RemoveSelectedItem () { public void RemoveSelectedItem () {
this.designerControl.RemoveSelectedItem (); this.designerControl.RemoveSelectedItem ();
} }
@ -425,13 +430,21 @@ namespace SharpReportAddin{
public void UpdateView(bool setViewDirty) { public void UpdateView(bool setViewDirty) {
this.tabControl.SelectedIndex = 0; this.tabControl.SelectedIndex = 0;
this.OnTabPageChanged(this,EventArgs.Empty); this.OnTabPageChanged(this,EventArgs.Empty);
SetOnPropertyChangedEvents(); // SetOnPropertyChangedEvents();
if (setViewDirty) { if (setViewDirty) {
this.OnPropertyChanged (this,new System.ComponentModel.PropertyChangedEventArgs("Fired from UpdateView")); this.OnPropertyChanged (this,new System.ComponentModel.PropertyChangedEventArgs("Fired from UpdateView"));
} }
} }
/// <summary>
/// Tells the <see cref="BaseDesignerControl"></see> to fire an Event if
/// something in the report layout changes
/// </summary>
public void RegisterPropertyChangedEvents () {
SetOnPropertyChangedEvents();
this.designerControl.RegisterEvents();
}
#endregion #endregion
@ -475,7 +488,6 @@ namespace SharpReportAddin{
} }
public override void RedrawContent() { public override void RedrawContent() {
// this.WorkbenchWindow.WindowDeselected += new EventHandler(OnDeselected);
SetHeadLines(); SetHeadLines();
} }
@ -535,7 +547,7 @@ namespace SharpReportAddin{
PropertyPad.Grid.Refresh(); PropertyPad.Grid.Refresh();
} }
this.designerControl.ReportModel.ReportSettings.AvailableFieldsCollection = reportManager.AvailableFieldsCollection; this.designerControl.ReportModel.ReportSettings.AvailableFieldsCollection = reportManager.AvailableFieldsCollection;
this.designerControl.RegisterEvents(); // this.designerControl.RegisterEvents();
} catch (Exception e) { } catch (Exception e) {
MessageService.ShowError(e,"SharpReportView:Load"); MessageService.ShowError(e,"SharpReportView:Load");

Loading…
Cancel
Save