📄 enduserdesignermainform.cs
字号:
// splitterDesignerProperties
//
this.splitterDesignerProperties.BackColor = System.Drawing.SystemColors.Control;
this.splitterDesignerProperties.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.splitterDesignerProperties.Dock = System.Windows.Forms.DockStyle.Right;
this.splitterDesignerProperties.Location = new System.Drawing.Point(556, 0);
this.splitterDesignerProperties.Name = "splitterDesignerProperties";
this.splitterDesignerProperties.Size = new System.Drawing.Size(4, 576);
this.splitterDesignerProperties.TabIndex = 3;
this.splitterDesignerProperties.TabStop = false;
//
// pnlProperties
//
this.pnlProperties.Controls.Add(this.arPropertyGrid);
this.pnlProperties.Controls.Add(this.splitterReportExplorerPropertyGrid);
this.pnlProperties.Controls.Add(this.arReportExplorer);
this.pnlProperties.Dock = System.Windows.Forms.DockStyle.Right;
this.pnlProperties.Location = new System.Drawing.Point(560, 0);
this.pnlProperties.Name = "pnlProperties";
this.pnlProperties.Size = new System.Drawing.Size(240, 576);
this.pnlProperties.TabIndex = 4;
//
// splitterReportExplorerPropertyGrid
//
this.splitterReportExplorerPropertyGrid.Dock = System.Windows.Forms.DockStyle.Top;
this.splitterReportExplorerPropertyGrid.Location = new System.Drawing.Point(0, 246);
this.splitterReportExplorerPropertyGrid.Name = "splitterReportExplorerPropertyGrid";
this.splitterReportExplorerPropertyGrid.Size = new System.Drawing.Size(240, 3);
this.splitterReportExplorerPropertyGrid.TabIndex = 1;
this.splitterReportExplorerPropertyGrid.TabStop = false;
//
// arReportExplorer
//
this.arReportExplorer.AutoScroll = true;
this.arReportExplorer.Dock = System.Windows.Forms.DockStyle.Top;
this.arReportExplorer.Location = new System.Drawing.Point(0, 0);
this.arReportExplorer.Name = "arReportExplorer";
this.arReportExplorer.ReportDesigner = null;
this.arReportExplorer.Size = new System.Drawing.Size(240, 246);
this.arReportExplorer.TabIndex = 0;
//
// arStatus
//
this.arStatus.Location = new System.Drawing.Point(0, 576);
this.arStatus.Name = "arStatus";
this.arStatus.Size = new System.Drawing.Size(800, 24);
this.arStatus.TabIndex = 5;
//
// commandBarManager
//
this.commandBarManager.Dock = System.Windows.Forms.DockStyle.Top;
this.commandBarManager.Location = new System.Drawing.Point(0, 0);
this.commandBarManager.Name = "commandBarManager";
this.commandBarManager.Size = new System.Drawing.Size(800, 0);
this.commandBarManager.TabIndex = 6;
this.commandBarManager.TabStop = false;
//
// EndUserDesignerMainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(800, 600);
this.Controls.Add(this.splitterDesignerProperties);
this.Controls.Add(this.arDesigner);
this.Controls.Add(this.splitterToolboxDesigner);
this.Controls.Add(this.pnlToolbox);
this.Controls.Add(this.pnlProperties);
this.Controls.Add(this.arStatus);
this.Controls.Add(this.commandBarManager);
this.Name = "EndUserDesignerMainForm";
this.Text = "Data Dynamics ActiveReports 3.0 Report Designer";
((System.ComponentModel.ISupportInitialize)(this.arToolbox)).EndInit();
this.pnlToolbox.ResumeLayout(false);
this.pnlProperties.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new EndUserDesignerMainForm());
}
private void LoadTools(DataDynamics.ActiveReports.Design.Toolbox.Toolbox toolbox)
{
//Add Data Providers
toolbox.AddToolboxItem(new System.Drawing.Design.ToolboxItem(typeof(System.Data.DataSet)), "Data");
toolbox.AddToolboxItem(new System.Drawing.Design.ToolboxItem(typeof(System.Data.DataView)), "Data");
toolbox.AddToolboxItem(new System.Drawing.Design.ToolboxItem(typeof(System.Data.OleDb.OleDbConnection)), "Data");
toolbox.AddToolboxItem(new System.Drawing.Design.ToolboxItem(typeof(System.Data.OleDb.OleDbDataAdapter)), "Data");
toolbox.AddToolboxItem(new System.Drawing.Design.ToolboxItem(typeof(System.Data.Odbc.OdbcConnection)), "Data");
toolbox.AddToolboxItem(new System.Drawing.Design.ToolboxItem(typeof(System.Data.Odbc.OdbcDataAdapter)), "Data");
toolbox.AddToolboxItem(new System.Drawing.Design.ToolboxItem(typeof(System.Data.SqlClient.SqlConnection)), "Data");
toolbox.AddToolboxItem(new System.Drawing.Design.ToolboxItem(typeof(System.Data.SqlClient.SqlDataAdapter)), "Data");
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (this.arDesigner.CommandBarManager.PreProcessMessage(ref msg))
return true;
return base.ProcessCmdKey (ref msg, keyData);
}
#region "Designer Events"
private void arDesigner_SelectionChanged()
{
string curSelection = "";
IEnumerator selectionEnum = null;
if(arDesigner.Selection != null)
selectionEnum = arDesigner.Selection.GetEnumerator();
while(selectionEnum != null && selectionEnum.MoveNext())
{
if(selectionEnum.Current is Section)
curSelection = curSelection + (selectionEnum.Current as Section).Name + ", ";
if(selectionEnum.Current is ARControl)
curSelection = curSelection + (selectionEnum.Current as ARControl).Name + ", ";
if(selectionEnum.Current is Field)
curSelection = curSelection + (selectionEnum.Current as Field).Name + ", ";
if(selectionEnum.Current is Parameter)
curSelection = curSelection + (selectionEnum.Current as Parameter).Key + ", ";
if(selectionEnum.Current is ActiveReport3)
curSelection = curSelection + (selectionEnum.Current as ActiveReport3).Document.Name + ", ";
}
if(this.arStatus.Created && this.arStatus.Panels[1] != null)
{
if(curSelection != "")
this.arStatus.Panels[1].Text = "Current Selection: " + curSelection.Substring(0, curSelection.Length - 2);
else
this.arStatus.Panels[1].Text = "No Selection";
}
}
#endregion
/// <summary>
/// OnExit
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnExit(object sender, CommandEventArgs e)
{
this.Close();
}
private void arDesigner_LayoutChanged(object sender, DataDynamics.ActiveReports.Design.LayoutChangedArgs e)
{
switch(e.Type)
{
case LayoutChangeType.ReportLoad:
case LayoutChangeType.ReportClear:
this.arReportExplorer.Report = this.arDesigner.Report;
break;
default:
break;
}
}
private void CommandBarButton_Click(object sender, CommandEventArgs e)
{
if (sender is CommandBarButton)
{
CommandBarButton button = sender as CommandBarButton;
switch (button.CommandID)
{
//Save Report CommandID
case 5:
this.arDesigner.SaveReport("d://na.xml");
this.arReportExplorer.Report.SaveLayout("d://Report.RPX");
MessageBox.Show("New Save");
break;
default:
break;
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -