context: using System;
  using System.Drawing;
  using System.Collections;
  using System.ComponentModel;
  using System.Windows.Forms;
  using System.Data;
  using System.Net;
  using System.Drawing.Imaging;
  using System.IO;
  using System.Threading;
  using System.Globalization;
  using System.Reflection;
  using System.Text.RegularExpressions;
  
  namespace PetriNetSimulator2
  {
  	/// <summary>
  	/// Summary description for Form1.
  	/// </summary>
  	public class MainWindow : System.Windows.Forms.Form
  	{
  		private string sApplicationName = "Petri .NET Simulator";
  		private int iNextUntitledDocumentIndex = 1;
  		private PetriNetDocument pndSelectedDocument = null;
  		private ArrayList alDocuments = new ArrayList();
  		private RulesEditor reRulesEditor = new RulesEditor();
          private PyEditor    rePythonEditor = new PyEditor();
          private PyOutput rePythonOutput = new PyOutput();
  		private Simulator sSimulator = null;
  		private ProgressBar pbSimulationProgress;
          private RecentFilesManager rfm = null;
  
  		protected Crownwood.Magic.Docking.DockingManager dmDockingManager = null;
  
  		public Crownwood.Magic.Menus.MenuControl mcMenuControl = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFile = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFileNew = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFileOpen = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFileClose = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFileSeparator1 = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFileSave = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFileSaveAs = null;
          private Crownwood.Magic.Menus.MenuCommand mcFileSaveXML = null;
          private Crownwood.Magic.Menus.MenuCommand mcFileLoadXML = null;
          private Crownwood.Magic.Menus.MenuCommand mcFileSaveMatrix = null;
          private Crownwood.Magic.Menus.MenuCommand mcFileSaveCpp = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFileSeparator2 = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFileExport = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFileSeparator3 = null;
          private Crownwood.Magic.Menus.MenuCommand mcFileRecentFiles = null;
          private Crownwood.Magic.Menus.MenuCommand mcFileSeparator4 = null;
  		private Crownwood.Magic.Menus.MenuCommand mcFileExit = null;
  
  
  		private Crownwood.Magic.Menus.MenuCommand mcEdit = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditUndo = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditRedo = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditSeparator1 = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditCut = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditCopy = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditPaste = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditDelete = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditSeparator2 = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditCopyModel = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditSeparator3 = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditGroup = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditSeparator4 = null;
  		private Crownwood.Magic.Menus.MenuCommand mcEditSelectAll = null;
  
          private Crownwood.Magic.Menus.MenuCommand mcSimulate = null;
          private Crownwood.Magic.Menus.MenuCommand mcSimulateStart = null;
          private Crownwood.Magic.Menus.MenuCommand mcSimulateStartWithParam = null;
          private Crownwood.Magic.Menus.MenuCommand mcSimulateStep = null;
          private Crownwood.Magic.Menus.MenuCommand mcSimulateStop = null;
          private Crownwood.Magic.Menus.MenuCommand mcSimulateReset = null;
  
  		private Crownwood.Magic.Menus.MenuCommand mcView = null;
  		private Crownwood.Magic.Menus.MenuCommand mcHelp = null;
  		private Crownwood.Magic.Menus.MenuCommand mcHelpManual = null;
  		private Crownwood.Magic.Menus.MenuCommand mcHelpSeparator1 = null;
  		private Crownwood.Magic.Menus.MenuCommand mcHelpCheckForUpdates = null;
  		private Crownwood.Magic.Menus.MenuCommand mcHelpAbout = null;
  
  		private ToolBar tbToolBar = new ToolBar();
  		private ToolBarButton tbbNew = new ToolBarButton();
  		private ToolBarButton tbbOpen = new ToolBarButton();
  		private ToolBarButton tbbSave = new ToolBarButton();
  		private ToolBarButton tbbSeparator1 = new ToolBarButton();
  		private ToolBarButton tbbReset = new ToolBarButton();
  		private ToolBarButton tbbStart = new ToolBarButton();
  		private ToolBarButton tbbPause = new ToolBarButton();
  		private ToolBarButton tbbStop = new ToolBarButton();
  		private ToolBarButton tbbStep = new ToolBarButton();
  		private ToolBarButton tbbSeparator2 = new ToolBarButton();
  		private ToolBarButton tbbConflicts = new ToolBarButton();
  		private ToolBarButton tbbCircularWaits = new ToolBarButton();
  		private ToolBarButton tbbFireable = new ToolBarButton();
  		private ToolBarButton tbbFired = new ToolBarButton();
  		private ToolBarButton tbbSeparator3 = new ToolBarButton();
  		private ToolBarButton tbbZoom = new ToolBarButton();
  		private ToolBarButton tbbSeparator4 = new ToolBarButton();
  		private ToolBarButton tbbUndo = new ToolBarButton();
  		private ToolBarButton tbbRedo = new ToolBarButton();
  
  		private ContextMenu cmUndo = new ContextMenu();
  		private ContextMenu cmRedo = new ContextMenu();
  
  		private PropertiesInspector piPropertiesInspector = new PropertiesInspector();
  		private ToolBox tbToolBox = new ToolBox();
  		private DocumentExplorer deDocumentExplorer = new DocumentExplorer();
  
  		private CDiese.Actions.ActionList alMenuActionList = new CDiese.Actions.ActionList();
  		private CDiese.Actions.Action aCloseFile = new CDiese.Actions.Action();
  		private CDiese.Actions.Action aSaveFile = new CDiese.Actions.Action();
  		private CDiese.Actions.Action aSaveAsFile = new CDiese.Actions.Action();
          private CDiese.Actions.Action aSaveXML = new CDiese.Actions.Action();
          private CDiese.Actions.Action aLoadXML = new CDiese.Actions.Action();
          private CDiese.Actions.Action aSaveMatrix = new CDiese.Actions.Action();
          private CDiese.Actions.Action aSaveCpp = new CDiese.Actions.Action();
  		private CDiese.Actions.Action aEditUndo = new CDiese.Actions.Action();
  		private CDiese.Actions.Action aEditRedo = new CDiese.Actions.Action();
  		private CDiese.Actions.Action aEditDelete = new CDiese.Actions.Action();
  		private CDiese.Actions.Action aEditCut = new CDiese.Actions.Action();
  		private CDiese.Actions.Action aEditCopy = new CDiese.Actions.Action();
  		private CDiese.Actions.Action aEditPaste = new CDiese.Actions.Action();
  		private CDiese.Actions.Action aEditGroup = new CDiese.Actions.Action();
  		private CDiese.Actions.Action aEditSelectAll = new CDiese.Actions.Action();
  
  #if DEMO
  		private System.Windows.Forms.Timer tmrDemoTimer = new System.Windows.Forms.Timer();
  		private int iTimeout = 900;
  #endif
  
  		private System.Windows.Forms.StatusBar sbStatusBar;
  		private Crownwood.Magic.Controls.TabControl tabMagicTab;
          private Crownwood.Magic.Docking.Content pythoneditor;
          private Crownwood.Magic.Docking.Content pythoneoutput;
  		private System.Windows.Forms.ImageList ilToolBar;
  		private System.Windows.Forms.ImageList ilTabImages;
  		private System.Windows.Forms.Panel pnlDocumentPanel;
  		private System.Windows.Forms.ImageList ilMenu;
  		private System.Windows.Forms.ContextMenu cmZoom;
  		private System.Windows.Forms.MenuItem miZoom100;
  		private System.Windows.Forms.MenuItem miZoom90;
  		private System.Windows.Forms.MenuItem miZoom70;
  		private System.Windows.Forms.MenuItem miZoom60;
  		private System.Windows.Forms.MenuItem miZoom50;
  		private System.Windows.Forms.MenuItem miZoom80;
          private System.Windows.Forms.SaveFileDialog sfdSaveXMLFile;
          private System.Windows.Forms.OpenFileDialog sfdLoadXMLFile;
          private System.Windows.Forms.SaveFileDialog sfdSaveMatrixFile;
          private System.Windows.Forms.SaveFileDialog sfdSaveCppFile;
  		private System.Windows.Forms.SaveFileDialog sfdSaveFile;
  		private System.Windows.Forms.OpenFileDialog ofdOpenFile;
  		private System.Windows.Forms.StatusBarPanel sbpPanelMain;
  		private System.Windows.Forms.StatusBarPanel sbpSimulationTimePanel;
  		private System.Windows.Forms.SaveFileDialog sfdExportFile;
  		private System.ComponentModel.IContainer components;
  
          private Boolean loadCronwoodFail;   // Handle problems.. 
  
  		#region private PetriNetDocument SelectedDocument
  		private PetriNetDocument SelectedDocument
  		{
  			get
  			{
  				return this.pndSelectedDocument;
  			}
  			set
  			{
  				this.pndSelectedDocument = value;
  
  				this.MainWindow_SetCaption();
  			}
  		}
  		#endregion
  
  		#region private ArrayList Documents
  		private ArrayList Documents
  		{
  			get
  			{
  				return this.alDocuments;
  			}
  		}
  		#endregion
  
  		/// <summary>
  		/// Clean up any resources being used.
  		/// </summary>
  		protected override void Dispose( bool disposing )
  		{
  			if( disposing )
  			{
                  if (this.sSimulator != null)
                  {
                      this.sSimulator.Dispose();
                  }
  
  				if (components != null)
  				{
  					components.Dispose();
  				}
  			}
  			base.Dispose( disposing );
  		}
  
  		#region Windows Form Designer generated code
  		/// <summary>
  		/// Required method for Designer support - do not modify
  		/// the contents of this method with the code editor.
  		/// </summary>
  		private void InitializeComponent()
  		{
              this.components = new System.ComponentModel.Container();
              System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
              this.ilToolBar = new System.Windows.Forms.ImageList(this.components);
              this.sbStatusBar = new System.Windows.Forms.StatusBar();
              this.sbpPanelMain = new System.Windows.Forms.StatusBarPanel();
              this.sbpSimulationTimePanel = new System.Windows.Forms.StatusBarPanel();
              this.tabMagicTab = new Crownwood.Magic.Controls.TabControl();
              this.ilTabImages = new System.Windows.Forms.ImageList(this.components);
              this.pnlDocumentPanel = new System.Windows.Forms.Panel();
              this.ilMenu = new System.Windows.Forms.ImageList(this.components);
              this.aCloseFile = new CDiese.Actions.Action(this.components);
              this.cmZoom = new System.Windows.Forms.ContextMenu();
              this.miZoom100 = new System.Windows.Forms.MenuItem();
              this.miZoom90 = new System.Windows.Forms.MenuItem();
              this.miZoom80 = new System.Windows.Forms.MenuItem();
              this.miZoom70 = new System.Windows.Forms.MenuItem();
              this.miZoom60 = new System.Windows.Forms.MenuItem();
              this.miZoom50 = new System.Windows.Forms.MenuItem();
              this.sfdSaveFile = new System.Windows.Forms.SaveFileDialog();
              this.sfdSaveXMLFile = new System.Windows.Forms.SaveFileDialog();
              this.sfdLoadXMLFile = new System.Windows.Forms.OpenFileDialog();
              this.sfdSaveMatrixFile = new System.Windows.Forms.SaveFileDialog();
              this.sfdSaveCppFile = new System.Windows.Forms.SaveFileDialog();
              this.ofdOpenFile = new System.Windows.Forms.OpenFileDialog();
              this.sfdExportFile = new System.Windows.Forms.SaveFileDialog();
              ((System.ComponentModel.ISupportInitialize)(this.sbpPanelMain)).BeginInit();
              ((System.ComponentModel.ISupportInitialize)(this.sbpSimulationTimePanel)).BeginInit();
              this.pnlDocumentPanel.SuspendLayout();
              this.SuspendLayout();
              // 
              // ilToolBar
              // 
              this.ilToolBar.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilToolBar.ImageStream")));
              this.ilToolBar.TransparentColor = System.Drawing.Color.Transparent;
              this.ilToolBar.Images.SetKeyName(0, "");
              this.ilToolBar.Images.SetKeyName(1, "");
              this.ilToolBar.Images.SetKeyName(2, "");
              this.ilToolBar.Images.SetKeyName(3, "");
              this.ilToolBar.Images.SetKeyName(4, "");
              this.ilToolBar.Images.SetKeyName(5, "");
              this.ilToolBar.Images.SetKeyName(6, "");
              this.ilToolBar.Images.SetKeyName(7, "");
              this.ilToolBar.Images.SetKeyName(8, "");
              this.ilToolBar.Images.SetKeyName(9, "");
              this.ilToolBar.Images.SetKeyName(10, "");
              this.ilToolBar.Images.SetKeyName(11, "");
              this.ilToolBar.Images.SetKeyName(12, "");
              this.ilToolBar.Images.SetKeyName(13, "");
              this.ilToolBar.Images.SetKeyName(14, "");
              // 
              // sbStatusBar
              // 
              this.sbStatusBar.Location = new System.Drawing.Point(0, 450);
              this.sbStatusBar.Name = "sbStatusBar";
              this.sbStatusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
              this.sbpPanelMain,
              this.sbpSimulationTimePanel});
              this.sbStatusBar.ShowPanels = true;
              this.sbStatusBar.Size = new System.Drawing.Size(876, 21);
              this.sbStatusBar.TabIndex = 2;
              this.sbStatusBar.Text = "statusBar";
              // 
              // sbpPanelMain
              // 
              this.sbpPanelMain.Name = "sbpPanelMain";
              this.sbpPanelMain.Text = "Ready";
              // 
              // sbpSimulationTimePanel
              // 
              this.sbpSimulationTimePanel.Name = "sbpSimulationTimePanel";
              this.sbpSimulationTimePanel.Text = "SimulationTimePanel";
              // 
              // tabMagicTab
              // 
              this.tabMagicTab.Dock = System.Windows.Forms.DockStyle.Fill;
              this.tabMagicTab.HideTabsMode = Crownwood.Magic.Controls.TabControl.HideTabsModes.ShowAlways;
              this.tabMagicTab.Location = new System.Drawing.Point(0, 0);
              this.tabMagicTab.Name = "tabMagicTab";
              this.tabMagicTab.Size = new System.Drawing.Size(872, 446);
              this.tabMagicTab.TabIndex = 3;
              this.tabMagicTab.Visible = false;
              this.tabMagicTab.SelectionChanged += new System.EventHandler(this.tabMagicTab_SelectionChanged);
              this.tabMagicTab.ClosePressed += new System.EventHandler(this.tabMagicTab_ClosePressed);
              // 
              // ilTabImages
              // 
              this.ilTabImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilTabImages.ImageStream")));
              this.ilTabImages.TransparentColor = System.Drawing.Color.Transparent;
              this.ilTabImages.Images.SetKeyName(0, "");
              // 
              // pnlDocumentPanel
              // 
              this.pnlDocumentPanel.BackColor = System.Drawing.SystemColors.ControlDark;
              this.pnlDocumentPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
              this.pnlDocumentPanel.Controls.Add(this.tabMagicTab);
              this.pnlDocumentPanel.Dock = System.Windows.Forms.DockStyle.Fill;
              this.pnlDocumentPanel.Location = new System.Drawing.Point(0, 0);
              this.pnlDocumentPanel.Name = "pnlDocumentPanel";
              this.pnlDocumentPanel.Size = new System.Drawing.Size(876, 450);
              this.pnlDocumentPanel.TabIndex = 5;
              // 
              // ilMenu
              // 
              this.ilMenu.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilMenu.ImageStream")));
              this.ilMenu.TransparentColor = System.Drawing.Color.Transparent;
              this.ilMenu.Images.SetKeyName(0, "");
              this.ilMenu.Images.SetKeyName(1, "");
              this.ilMenu.Images.SetKeyName(2, "");
              this.ilMenu.Images.SetKeyName(3, "");
              this.ilMenu.Images.SetKeyName(4, "");
              this.ilMenu.Images.SetKeyName(5, "");
              this.ilMenu.Images.SetKeyName(6, "");
              this.ilMenu.Images.SetKeyName(7, "");
              this.ilMenu.Images.SetKeyName(8, "");
              this.ilMenu.Images.SetKeyName(9, "");
              this.ilMenu.Images.SetKeyName(10, "");
              this.ilMenu.Images.SetKeyName(11, "");
              this.ilMenu.Images.SetKeyName(12, "");
              this.ilMenu.Images.SetKeyName(13, "");
              this.ilMenu.Images.SetKeyName(14, "");
              this.ilMenu.Images.SetKeyName(15, "python-o.png");
              // 
              // aCloseFile
              // 
              this.aCloseFile.Checked = false;
              this.aCloseFile.Enabled = true;
              this.aCloseFile.Hint = null;
              this.aCloseFile.Shortcut = System.Windows.Forms.Shortcut.None;
              this.aCloseFile.Tag = null;
              this.aCloseFile.Text = null;
              this.aCloseFile.Visible = true;
              // 
              // cmZoom
              // 
              this.cmZoom.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
              this.miZoom100,
              this.miZoom90,
              this.miZoom80,
              this.miZoom70,
              this.miZoom60,
              this.miZoom50});
              this.cmZoom.Popup += new System.EventHandler(this.cmZoom_Popup);
              // 
              // miZoom100
              // 
              this.miZoom100.Checked = true;
              this.miZoom100.Index = 0;
              this.miZoom100.RadioCheck = true;
              this.miZoom100.Text = "100%";
              this.miZoom100.Click += new System.EventHandler(this.miZoom_Click);
              // 
              // miZoom90
              // 
              this.miZoom90.Index = 1;
              this.miZoom90.RadioCheck = true;
              this.miZoom90.Text = "90%";
              this.miZoom90.Click += new System.EventHandler(this.miZoom_Click);
              // 
              // miZoom80
              // 
              this.miZoom80.Index = 2;
              this.miZoom80.RadioCheck = true;
              this.miZoom80.Text = "80%";
              this.miZoom80.Click += new System.EventHandler(this.miZoom_Click);
              // 
              // miZoom70
              // 
              this.miZoom70.Index = 3;
              this.miZoom70.RadioCheck = true;
              this.miZoom70.Text = "70%";
              this.miZoom70.Click += new System.EventHandler(this.miZoom_Click);
              // 
              // miZoom60
              // 
              this.miZoom60.Index = 4;
              this.miZoom60.RadioCheck = true;
              this.miZoom60.Text = "60%";
              this.miZoom60.Click += new System.EventHandler(this.miZoom_Click);
              // 
              // miZoom50
              // 
              this.miZoom50.Index = 5;
              this.miZoom50.RadioCheck = true;
              this.miZoom50.Text = "50%";
              this.miZoom50.Click += new System.EventHandler(this.miZoom_Click);
              // 
              // sfdSaveFile
              // 
              this.sfdSaveFile.DefaultExt = "pnd";
              this.sfdSaveFile.Filter = "Petri .NET Document (*.pnd)|*.pnd";
              this.sfdSaveFile.Title = "Save PetriNET to file.";
              // 
              // sfdSaveXMLFile
              // 
              this.sfdSaveXMLFile.DefaultExt = "pnml";
              this.sfdSaveXMLFile.Filter = "Petri .NET XML Document (*.pnml)|*.pnml";
              this.sfdSaveXMLFile.Title = "Save PetriNET to XML file.";
              // 
              // sfdLoadXMLFile
              // 
              this.sfdLoadXMLFile.DefaultExt = "pnml";
              this.sfdLoadXMLFile.Filter = "Petri .NET XML Document (*.pnml)|*.pnml";
              this.sfdLoadXMLFile.Title = "Load PetriNET from XML file.";
              // 
              // sfdSaveMatrixFile
              // 
              this.sfdSaveMatrixFile.DefaultExt = "m";
              this.sfdSaveMatrixFile.Filter = "Matlab file (*.m)|*.m";
              this.sfdSaveMatrixFile.Title = "Save PetriNET to M file.";
              // 
              // sfdSaveCppFile
              // 
              this.sfdSaveCppFile.DefaultExt = "cpp";
              this.sfdSaveCppFile.Filter = "C++ file (*.cpp)|*.cpp";
              this.sfdSaveCppFile.Title = "Save PetriNET to C/CPP file.";
              // 
              // ofdOpenFile
              // 
              this.ofdOpenFile.DefaultExt = "pnd";
              this.ofdOpenFile.Filter = "Petri .NET Document (*.pnd)|*.pnd";
              this.ofdOpenFile.Title = "Open PetriNET from file.";
              // 
              // sfdExportFile
              // 
              this.sfdExportFile.DefaultExt = "emf";
              this.sfdExportFile.Filter = "Enhanced metafile (*.emf)|*.emf";
              this.sfdExportFile.Title = "Export Petri .NET model.";
              // 
              // MainWindow
              // 
              this.BackColor = System.Drawing.SystemColors.Control;
              this.ClientSize = new System.Drawing.Size(876, 471);
              this.Controls.Add(this.pnlDocumentPanel);
              this.Controls.Add(this.sbStatusBar);
              this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
              this.Name = "MainWindow";
              this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
              this.Text = "Form1";
              this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
              this.Load += new System.EventHandler(this.MainWindow_Load);
              this.Closing += new System.ComponentModel.CancelEventHandler(this.MainWindow_Closing);
              ((System.ComponentModel.ISupportInitialize)(this.sbpPanelMain)).EndInit();
              ((System.ComponentModel.ISupportInitialize)(this.sbpSimulationTimePanel)).EndInit();
              this.pnlDocumentPanel.ResumeLayout(false);
              this.ResumeLayout(false);
  
  		}
  		#endregion
  
  		/// <summary>
  		/// The main entry point for the application.
  		/// </summary>
  		[STAThread]
  		static void Main()
  		{
              try
              {
                  Application.Run(new MainWindow());
              }
              catch (Exception e)
              {
                  String poruka = "Message:\n";
                  poruka += e.Message;
                  poruka += "\n-------------------------------------------------------\nSource:\n";
                  poruka += e.Source;
                  poruka += "\n-------------------------------------------------------\nStack Trace:\n";
                  poruka += e.StackTrace;
  
                  Exception ei = e.InnerException;
                  if (ei != null)
                  {
                      poruka += "\n======================================================\nInner exception:\n";
                      poruka += ei.Message;
                  }
                  MessageBox.Show(poruka, "Exception");
              }
  		}
  
  		#region public MainWindow()
  		public MainWindow()
  		{
  			//
  			// Required for Windows Form Designer support
  			//
  			InitializeComponent();
  
  			// Create the object that manages the docking state
  			this.dmDockingManager = new Crownwood.Magic.Docking.DockingManager(this, Crownwood.Magic.Common.VisualStyle.IDE);
  			this.dmDockingManager.InnerControl = this.pnlDocumentPanel;
  			this.dmDockingManager.OuterControl = sbStatusBar;
  
  			Crownwood.Magic.Docking.Content toolbox = dmDockingManager.Contents.Add(this.tbToolBox, "Toolbox", this.ilMenu, 1);
  			toolbox.AutoHideSize = new Size(200, 300);
  
gt: 			toolbox.DisplaySize = new Size(200, 300);