📄 designreportdesignfrm.cs
字号:
using System;
using System.Globalization;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using DataDynamics.ActiveReports;
using DataDynamics.ActiveReports.Design;
using System.IO;
using DataDynamics.ActiveReports.Wizards;
namespace TreeReportApp
{
/// <summary>
/// 报表设计模块程序的主体窗口类
/// 主要控件有:报表设计器控件Designercontrol, 属性格(列表)property grid control, 报表对象浏览,可用数据字典,
/// 预览用的报表查看器viewer control等
/// </summary>
public class TreeReportDesignFrm : System.Windows.Forms.Form
{
#region Constructor + Class Members
private System.ComponentModel.IContainer components;
private System.Windows.Forms.ComboBox cboClassName;
private System.Windows.Forms.ComboBox cboFormatFonts;
private System.Collections.Hashtable comboHashTable = new Hashtable();
private System.Windows.Forms.StatusBar sb;
private System.Windows.Forms.Panel pnlPropertyWindow;
private System.Windows.Forms.ComboBox cboPropList;
private System.Windows.Forms.PropertyGrid arPropertyGrid;
private System.Windows.Forms.Panel pnlDesigner;
private System.Windows.Forms.ToolBar tbFormat;
private System.Windows.Forms.ToolBarButton tFormatBold;
private System.Windows.Forms.ToolBarButton tFormatItalic;
private System.Windows.Forms.ToolBarButton tFormatUnderline;
private System.Windows.Forms.ToolBarButton tFormatFontSettings;
private System.Windows.Forms.ToolBarButton tFormatSep1;
private System.Windows.Forms.ToolBarButton tFormatLeftAlign;
private System.Windows.Forms.ToolBarButton tFormatCenterAlign;
private System.Windows.Forms.ToolBarButton tFormatRightAlign;
private System.Windows.Forms.ToolBarButton tFormatSep2;
private System.Windows.Forms.ToolBarButton tFormatBullets;
private System.Windows.Forms.ToolBarButton tFormatOutdent;
private System.Windows.Forms.ToolBarButton tFormatIndent;
private System.Windows.Forms.ToolBarButton tFormatSep3;
private System.Windows.Forms.ToolBarButton tFormatBackColor;
private System.Windows.Forms.ToolBarButton tFormatForeColor;
private System.Windows.Forms.ToolBarButton tFormatLineColor;
private System.Windows.Forms.ToolBarButton tFormatLineStyle;
private System.Windows.Forms.ToolBarButton tFormatBorder;
private System.Windows.Forms.ToolBar tbAlign;
private System.Windows.Forms.ToolBarButton tAlignBringToFront;
private System.Windows.Forms.ToolBarButton tAlignSendToBack;
private System.Windows.Forms.ToolBarButton tAlignSep1;
private System.Windows.Forms.ToolBarButton tAlignLefts;
private System.Windows.Forms.ToolBarButton tAlignCenters;
private System.Windows.Forms.ToolBarButton tAlignRights;
private System.Windows.Forms.ToolBarButton tAlignSep2;
private System.Windows.Forms.ToolBarButton tAlignTops;
private System.Windows.Forms.ToolBarButton tAlignMiddles;
private System.Windows.Forms.ToolBarButton tAlignBottoms;
private System.Windows.Forms.ToolBarButton tAlignSep3;
private System.Windows.Forms.ToolBarButton tAlignToGrid;
private System.Windows.Forms.ToolBarButton tAlignSizeSameWidth;
private System.Windows.Forms.ToolBarButton tAlignSizeSameHeight;
private System.Windows.Forms.ToolBarButton tAlignSizeSameBoth;
private System.Windows.Forms.ToolBarButton tAlignSep4;
private System.Windows.Forms.ToolBarButton tAlignDecreaseHorizSpace;
private System.Windows.Forms.ToolBarButton tAlignMakeHorizSpaceEqual;
private System.Windows.Forms.ToolBarButton tAlignIncreaseHorizSpace;
private System.Windows.Forms.ToolBarButton tAlignSep5;
private System.Windows.Forms.ToolBarButton tAlignDecreaseVertSpace;
private System.Windows.Forms.ToolBarButton tAlignMakeVertSpaceEqual;
private System.Windows.Forms.ToolBarButton tAlignIncreaseVertSpace;
private System.Windows.Forms.ToolBarButton tAlignSep6;
private System.Windows.Forms.ToolBarButton tAlignLock;
private System.Windows.Forms.ToolBar tbToolbox;
private System.Windows.Forms.ToolBarButton tBOXPointer;
private System.Windows.Forms.ToolBarButton tBOXLabel;
private System.Windows.Forms.ToolBarButton tBOXTextbox;
private System.Windows.Forms.ToolBarButton tBOXCheckbox;
private System.Windows.Forms.ToolBarButton tBOXPicture;
private System.Windows.Forms.ToolBarButton tBOXShape;
private System.Windows.Forms.ToolBarButton tBOXLine;
private System.Windows.Forms.ToolBarButton tBOXRichText;
private System.Windows.Forms.ToolBarButton tBOXSubReport;
private System.Windows.Forms.ToolBarButton tBOXPageBreak;
private System.Windows.Forms.ToolBarButton tBOXBarcode;
private DataDynamics.ActiveReports.Design.ReportExplorer arReportExplorer;
private System.Windows.Forms.ToolBar tbStandard;
private System.Windows.Forms.ToolBarButton tSTDNewReport;
private System.Windows.Forms.ToolBarButton tSTDSep1;
private System.Windows.Forms.ToolBarButton tSTDOpen;
private System.Windows.Forms.ToolBarButton tSTDSave;
private System.Windows.Forms.ToolBarButton tSTDSaveAs;
private System.Windows.Forms.ToolBarButton tSTDSep2;
private System.Windows.Forms.ToolBarButton tSTDUndo;
private System.Windows.Forms.ToolBarButton tSTDCut;
private System.Windows.Forms.ToolBarButton tSTDCopy;
private System.Windows.Forms.ToolBarButton tSTDPaste;
private System.Windows.Forms.ToolBarButton tSTDDelete;
private System.Windows.Forms.ToolBarButton tSTDSep4;
private System.Windows.Forms.ToolBarButton tSTDGroupReorder;
private System.Windows.Forms.StatusBarPanel sbpStatus;
private System.Windows.Forms.TabControl tabMain;
private System.Windows.Forms.TabPage pagDesign;
private System.Windows.Forms.TabPage pagPreview;
private System.Windows.Forms.Splitter splitH;
private System.Windows.Forms.Panel pnlProperties;
private System.Windows.Forms.GroupBox grpDesignSurface;
private System.Windows.Forms.Splitter splitVR;
private System.Windows.Forms.MenuItem mnuLineTransparent;
private System.Windows.Forms.MenuItem mnuLineSolid;
private System.Windows.Forms.MenuItem mnuLineDash;
private System.Windows.Forms.MenuItem mnuLineDot;
private System.Windows.Forms.MenuItem mnuLineDashDot;
private System.Windows.Forms.MenuItem mnuLineDashDotDot;
//Developer Created Class Members
private bool _ExecuteCboFontName = true;
private bool _ExecuteCboFontSize = true;
private bool _ExecuteCboClassName = true;
private bool _alreadySaved = false;
private bool _controlAdded = false;
private bool _controlDeleted = false;
private bool _isCboDirty = false;
private string _savedPath = "";
private bool _sectionAdded = false;
private System.Windows.Forms.ComboBox cboFormatFontSize;
private bool _sectionDeleted = false;
private bool _editPropList = false;
//Used to Determine type of Control being added to the ComboHashTable
private enum ComboItemType
{
ActiveReport,
Section,
Control
}
//Used to Determine if IDE is in Design mode or Preview Mode
private bool _designView = true;
private System.Windows.Forms.MenuItem mnuFileExport;
private System.Windows.Forms.MenuItem mnuFileSaveAs;
private System.Windows.Forms.MenuItem mnuFileSep1;
private System.Windows.Forms.ImageList imgStandard;
private System.Windows.Forms.MenuItem mnuFileSave;
private System.Windows.Forms.MenuItem mnuFileSep2;
private System.Windows.Forms.MenuItem mnuFilePrint;
private System.Windows.Forms.MenuItem mnuFilePrintPreview;
private System.Windows.Forms.ImageList imgToolbox;
private System.Windows.Forms.MenuItem mnuFileOpen;
private System.Windows.Forms.MenuItem mnuFileExit;
private System.Windows.Forms.MenuItem mnuFile;
private System.Windows.Forms.MenuItem mnuFileNew;
private System.Windows.Forms.MenuItem mnuFileReportProperties;
private System.Windows.Forms.MenuItem mnuFileSep3;
private System.Windows.Forms.MainMenu mnuMain;
private System.Windows.Forms.MenuItem mnuEdit;
private System.Windows.Forms.MenuItem mnuEditUndo;
private System.Windows.Forms.MenuItem mnuEditSep1;
private System.Windows.Forms.MenuItem mnuEditCut;
private System.Windows.Forms.MenuItem mnuEditCopy;
private System.Windows.Forms.MenuItem mnuEditCopyPage;
private System.Windows.Forms.MenuItem mnuEditPaste;
private System.Windows.Forms.MenuItem mnuEditSep2;
private System.Windows.Forms.MenuItem mnuEditDelete;
private System.Windows.Forms.MenuItem mnuEditDeleteSec;
private System.Windows.Forms.MenuItem mnuEditSep3;
private System.Windows.Forms.MenuItem mnuEditFind;
private System.Windows.Forms.MenuItem mnuEditSep4;
private System.Windows.Forms.MenuItem mnuEditReorder;
private System.Windows.Forms.MenuItem mnuEditProperties;
private System.Windows.Forms.MenuItem mnuView;
private System.Windows.Forms.MenuItem mnuViewDesignView;
private System.Windows.Forms.MenuItem mnuViewPrintPreview;
private System.Windows.Forms.MenuItem mnuViewSep1;
private System.Windows.Forms.MenuItem mnuViewPropertiesList;
private System.Windows.Forms.MenuItem mnuViewDataSource;
private System.Windows.Forms.MenuItem mnuViewFieldsList;
private System.Windows.Forms.MenuItem mnuViewCodeEditor;
private System.Windows.Forms.MenuItem mnuViewSep2;
private System.Windows.Forms.MenuItem mnuViewGrid;
private System.Windows.Forms.MenuItem mnuViewToolbars;
private System.Windows.Forms.MenuItem mnuViewStandard;
private System.Windows.Forms.MenuItem mnuViewFormat;
private System.Windows.Forms.MenuItem mnuViewToolbox;
private System.Windows.Forms.MenuItem mnuViewAlign;
private System.Windows.Forms.MenuItem mnuViewRuler;
private System.Windows.Forms.MenuItem mnuInsert;
private System.Windows.Forms.MenuItem mnuInsertReportHF;
private System.Windows.Forms.MenuItem mnuInsertPageHF;
private System.Windows.Forms.MenuItem mnuInsertHF;
private System.Windows.Forms.MenuItem mnuInsertSep1;
private System.Windows.Forms.MenuItem mnuInsertLabel;
private System.Windows.Forms.MenuItem mnuInsertTextbox;
private System.Windows.Forms.MenuItem mnuInsertCheckbox;
private System.Windows.Forms.MenuItem mnuInsertBarcode;
private System.Windows.Forms.MenuItem mnuInsertLine;
private System.Windows.Forms.MenuItem mnuInsertShape;
private System.Windows.Forms.MenuItem mnuInsertImage;
private System.Windows.Forms.MenuItem mnuInsertRichTextbox;
private System.Windows.Forms.MenuItem mnuInsertSubReport;
private System.Windows.Forms.MenuItem mnuInsertPageBreak;
private System.Windows.Forms.MenuItem mnuInsertOle;
private System.Windows.Forms.MenuItem mnuFormat;
private System.Windows.Forms.MenuItem mnuAlign;
private System.Windows.Forms.MenuItem mnuFormatAlignLefts;
private System.Windows.Forms.MenuItem mnuFormatAlignCenters;
private System.Windows.Forms.MenuItem mnuFormatAlignRights;
private System.Windows.Forms.MenuItem mnuFormatSep3;
private System.Windows.Forms.MenuItem mnuFormatAlignTops;
private System.Windows.Forms.MenuItem mnuFormatAlignMiddles;
private System.Windows.Forms.MenuItem mnuFormatAlignBottoms;
private System.Windows.Forms.MenuItem mnuFormatSep4;
private System.Windows.Forms.MenuItem mnuFormatAligntoGrid;
private System.Windows.Forms.MenuItem mnuSize;
private System.Windows.Forms.MenuItem mnuFormatSizeWidth;
private System.Windows.Forms.MenuItem mnuFormatSizeHeight;
private System.Windows.Forms.MenuItem mnuFormatSizeBoth;
private System.Windows.Forms.MenuItem mnuFormatHSpacing;
private System.Windows.Forms.MenuItem mnuFormatHSpacingEqual;
private System.Windows.Forms.MenuItem mnuFormatHSpacingIncrease;
private System.Windows.Forms.MenuItem mnuFormatHSpacingDecrease;
private System.Windows.Forms.MenuItem mnuFormatVSpacing;
private System.Windows.Forms.MenuItem mnuFormatVSpacingEqual;
private System.Windows.Forms.MenuItem mnuFormatVSpacingIncrease;
private System.Windows.Forms.MenuItem mnuFormatVSpacingDecrease;
private System.Windows.Forms.MenuItem mnuFormatSep1;
private System.Windows.Forms.MenuItem mnuFormatBringToFront;
private System.Windows.Forms.MenuItem mnuFormatSendToBack;
private System.Windows.Forms.MenuItem mnuFormatSep2;
private System.Windows.Forms.MenuItem mnuFormatLock;
private System.Windows.Forms.MenuItem mnuHelp;
private System.Windows.Forms.MenuItem mnuHelpActiveReports;
private System.Windows.Forms.MenuItem mnuHelpSep;
private System.Windows.Forms.MenuItem mnuHelpAbout;
private System.Windows.Forms.OpenFileDialog dlgOpenFile;
private System.Windows.Forms.SaveFileDialog dlgSaveFile;
private System.Windows.Forms.FontDialog dlgFont;
private System.Windows.Forms.ImageList imgAlign;
private System.Windows.Forms.ImageList imgFormat;
private DataDynamics.ActiveReports.Design.Designer ardMain;
private System.Windows.Forms.ContextMenu cxtLineStyle;
private DataDynamics.ActiveReports.Viewer.Viewer arvMain;
private System.Windows.Forms.ColorDialog dlgColor;
private System.Windows.Forms.ToolBarButton tBOXChart;
private System.Windows.Forms.ToolBarButton tSTDreportopenfromdb;
private System.Windows.Forms.ToolBarButton tSTDreportsavetodb;
private System.Windows.Forms.ToolBarButton tSTDreportsaveastodb;
private System.Windows.Forms.ToolBarButton tSTDreportmanageinfo;
private System.Windows.Forms.ToolBarButton tSTDreportsetuser;
private System.Windows.Forms.ToolBarButton tSTDSep6;
private System.Windows.Forms.ToolBarButton tSTDreportdatadict;
private System.Windows.Forms.ToolBarButton tSTDSep7;
private System.Windows.Forms.ToolBarButton tSTDEnglish;
private System.Windows.Forms.ToolBarButton tSTDChinese;
private System.Windows.Forms.ToolBarButton tSTDHKChinese;
private System.Windows.Forms.ToolBarButton tSTDSep8;
//Used to store previous control sizes
private int _widthOfPropertyList = 176;
private System.Data.OleDb.OleDbConnection conn;
private System.Windows.Forms.ToolBarButton tSTDshowdictitem;
private System.Windows.Forms.ToolBarButton tSTDdatasource;
private System.Windows.Forms.ToolBarButton tSTDshowdatafield;
private System.Windows.Forms.ListView listView_DataDict;
private System.Windows.Forms.ToolBarButton tSTDconfigurable;
private System.Windows.Forms.MenuItem mnuDbSaveAs;
private System.Windows.Forms.MenuItem mnuDbSave;
private System.Windows.Forms.MenuItem mnuDbOpen;//报表管理信息
public TreeReportConfigInfo configinfo;
private System.Windows.Forms.ToolBarButton tSTDconfiglist;
private System.Windows.Forms.ToolBarButton tSTDsearchfield;//报表可二次配置信息
public ReportManageInfo manageinfo;//管理信息对象
public TreeReportDesignFrm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//连接据库,这段程序用一个公共连接类代替
conn.ConnectionString = TreeConnection.connstr;
configinfo = new TreeReportConfigInfo();//报表可二次配置信息
//传入二次配置信息对象,在管理信息对象中引用二次配置信息对象,方便保证数据的一致性
//manageinfo._ConfigInfo = this.configinfo;
manageinfo = new ReportManageInfo(configinfo,this);//报表管理信息
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -