System.Object
Eplan.EplApi.HEServices.DrawingService
System.Object
Eplan.EplApi.HEServices.DrawingService
//prepare window macro WindowMacro oWindowMacro = new WindowMacro(); oWindowMacro.Open("$(MD_MACROS)\\ENT.11043516.ema", m_oTestProject); //prepare DrawingService DrawingService oDrawingService = new DrawingService(); oDrawingService.MacroPreview = true; oDrawingService.CreateDisplayList(oWindowMacro); //prepare preview form Form oForm = new Form(); Panel oPanel = new Panel(); oPanel.Dock = DockStyle.Fill; oPanel.Size = new System.Drawing.Size((int)oWindowMacro.Size.X, (int)oWindowMacro.Size.Y); oForm.Controls.Add(oPanel); oPanel.Paint += delegate(object sender, PaintEventArgs e) { oDrawingService.DrawDisplayList(e, oForm.ClientRectangle); }; //show preview oForm.Show();
public void DisplayPlacements() { try { Project oPrj = new ProjectManager().OpenProject("$(MD_PROJECTS)\\ESS_Sample_Project.elk"); if (oPrj == null || !oPrj.IsOpen) { return; } Page[] arrPages = oPrj.Pages; Placement[] arrPlacements = null; foreach (Page oPage in arrPages) { if (oPage.AllPlacements.Length > 0) { arrPlacements = oPage.AllPlacements; break; } } if (arrPlacements != null) { PreviewForm frm = new PreviewForm(); frm.Placements = arrPlacements; frm.ShowDialog(); } } catch (Eplan.EplApi.Base.BaseException e) { Console.Out.WriteLine(e.Message); } } ///////////////////// // PreviewForm.cs // ///////////////////// internal class PreviewForm : System.Windows.Forms.Form { private System.ComponentModel.Container components = null; private System.Windows.Forms.Panel pnlPreview; private System.Windows.Forms.Panel pnlCtrls; private Eplan.EplApi.DataModel.Placement[] _arrPalcements = null; //array of Placements to preview private System.Windows.Forms.ToolBarButton btnZoomAll; private System.Windows.Forms.ToolBarButton btnZoomIn; private System.Windows.Forms.ToolBarButton btnZoomOut; private System.Windows.Forms.ToolBarButton separator; private System.Windows.Forms.ToolBar toolBarPreview; private System.Windows.Forms.ToolBarButton btnDrawConenctions; private System.Windows.Forms.ToolBarButton btnBlackWhite; private Eplan.EplApi.HEServices.DrawingService dwgService = new Eplan.EplApi.HEServices.DrawingService(); public Eplan.EplApi.DataModel.Placement[] Placements { get { return _arrPalcements; } set { _arrPalcements = value; if (value != null) dwgService.CreateDisplayList(value); } } public PreviewForm() { InitializeComponent(); this.btnZoomAll.Text = "Zoom all"; this.btnZoomIn.Text = "Zoom in"; this.btnZoomOut.Text = "Zoom out"; this.separator.Text = "Separator"; this.btnDrawConenctions.Text = "Draw connections"; this.btnBlackWhite.Text = "Black white"; } /// Clean up any resources being used. protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); } /// Required method for Designer support - do not modify /// the contents of this method with the code editor. private void InitializeComponent() { this.pnlPreview = new System.Windows.Forms.Panel(); this.pnlCtrls = new System.Windows.Forms.Panel(); this.toolBarPreview = new System.Windows.Forms.ToolBar(); this.btnZoomAll = new System.Windows.Forms.ToolBarButton(); this.btnZoomIn = new System.Windows.Forms.ToolBarButton(); this.btnZoomOut = new System.Windows.Forms.ToolBarButton(); this.separator = new System.Windows.Forms.ToolBarButton(); this.btnDrawConenctions = new System.Windows.Forms.ToolBarButton(); this.btnBlackWhite = new System.Windows.Forms.ToolBarButton(); this.pnlCtrls.SuspendLayout(); this.SuspendLayout(); this.Resize += new System.EventHandler(this.ResizeEndHandler); // // pnlPreview // this.pnlPreview.BackColor = System.Drawing.Color.WhiteSmoke; this.pnlPreview.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlPreview.Location = new System.Drawing.Point(0, 0); this.pnlPreview.Name = "pnlPreview"; this.pnlPreview.Size = new System.Drawing.Size(292, 266); this.pnlPreview.TabIndex = 0; this.pnlPreview.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlPreview_Paint); // // pnlCtrls // this.pnlCtrls.Controls.Add(this.toolBarPreview); this.pnlCtrls.Dock = System.Windows.Forms.DockStyle.Top; this.pnlCtrls.Location = new System.Drawing.Point(0, 0); this.pnlCtrls.Name = "pnlCtrls"; this.pnlCtrls.Size = new System.Drawing.Size(292, 40); this.pnlCtrls.TabIndex = 1; // // toolBarPreview // this.toolBarPreview.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { this.btnZoomAll, this.btnZoomIn, this.btnZoomOut, this.separator, this.btnDrawConenctions, this.btnBlackWhite}); this.toolBarPreview.DropDownArrows = true; this.toolBarPreview.Location = new System.Drawing.Point(0, 0); this.toolBarPreview.Name = "toolBarPreview"; this.toolBarPreview.ShowToolTips = true; this.toolBarPreview.Size = new System.Drawing.Size(292, 28); this.toolBarPreview.TabIndex = 0; this.toolBarPreview.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBarPreview_ButtonClick); // // separator // this.separator.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; // // btnDrawConenctions // this.btnDrawConenctions.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton; // // btnBlackWhite // this.btnBlackWhite.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton; // // PreviewForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.Add(this.pnlCtrls); this.Controls.Add(this.pnlPreview); this.Name = "PreviewForm"; this.Text = "Preview"; this.pnlCtrls.ResumeLayout(false); this.ResumeLayout(false); } private void ResizeEndHandler(object sender, EventArgs e) { this.Invalidate(); this.Refresh(); } private void pnlPreview_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { if (_arrPalcements != null) { dwgService.DrawDisplayList(e, this.ClientRectangle); } } private void toolBarPreview_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { if (e.Button == this.btnZoomAll) { dwgService.ZoomAll(); } else if (e.Button == this.btnZoomIn) { dwgService.ZoomIn(2.0); } else if (e.Button == this.btnZoomOut) { dwgService.ZoomOut(2.0); } else if (e.Button == this.btnDrawConenctions) { dwgService.DrawConnections = this.btnDrawConenctions.Pushed; if (_arrPalcements != null) dwgService.CreateDisplayList(_arrPalcements); } else if (e.Button == this.btnBlackWhite) { dwgService.DrawBlackAndWhite = this.btnBlackWhite.Pushed; if (_arrPalcements != null) dwgService.CreateDisplayList(_arrPalcements); } pnlPreview.Refresh(); } }
Name | Description | |
---|---|---|
DrawingService Constructor | default constructor. |
Name | Description | |
---|---|---|
CenterView | Is the preview centered or not? | |
DrawBackGround | Gets/Sets whether the preview is created with or without background. | |
DrawBlackAndWhite | Should the preview be shown in color or black-and-white? Warning: images are always colored, independently on a value of the property | |
DrawConnections | Should the auto-connecting lines be drawn in a macro preview or not? | |
DrawCrossReferences | Determines, whether cross references should be displayed or not. | |
DrawInvisibleObjects | Determines, that the preview should show invisible objects or not ? | |
MacroPreview | Determines, that the preview should look similar to the macro preview in the GUI or not | |
UseThumbnail | Use of the stored thumbnail bitmap for preview macro files or not ? |
Name | Description | |
---|---|---|
CreateDisplayList | Overloaded. Creates a display list for a symbol variant. Removes the representation of previously displayed objects when creating a new list. If parameter bReturnSymbolConnectionPointsData is TRUE, return also a structure with information about the symbol variant's connection points | |
Dispose | Default destructor. | |
DrawDisplayList | Overloaded. Draws a display list on a window. The preview is fit to the window, while keeping its aspect ratio. Only the rectangle specified by the parameter rcClientRect will be used | |
GetViewport | Gets the coordinates of the viewport region | |
Reset | Resets all settings of the class to standard values. | |
SetDefaultViewport | Adjusts viewport to the bounding box of the objects from drawing list | |
SetDefaultWindow | Sets resolution of the drawn image to 100x100. | |
setDrawingFlags | For internal use. | |
SetViewport | Sets the coordinates of the viewport region | |
SetWindow | Overloaded. Defines resolution of the drawn image. | |
testDrawingFlags | For internal use. | |
unsetDrawingFlags | For internal use. | |
ZoomAll | Recalculates the view port so the complete image is displayed. | |
ZoomIn | Recalculates the view port to zoom into the image. | |
ZoomOut | Recalculates the view port to zoom out of the image. |
DrawingService Members
Eplan.EplApi.HEServices Namespace
HE_Display.html