using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Reflection;

using Amyuni.PDFCreator;

namespace PDFCreatorApp
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class AppForm : System.Windows.Forms.Form
	{
		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menuItemFile;
		private System.Windows.Forms.MenuItem menuItemFileOpen;
		private System.Windows.Forms.MenuItem menuItemExit;
		private System.Windows.Forms.MenuItem menuItemPrint;
		private System.Windows.Forms.MenuItem menuItemSave;
		private System.Windows.Forms.MenuItem menuItem5;
		private System.Windows.Forms.MenuItem menuItemStartSave;
		private System.Windows.Forms.MenuItem menuItemEndSave;
		private System.Windows.Forms.MenuItem menuItemSavePage;
		private System.Windows.Forms.MenuItem menuItemUndo;
		private System.Windows.Forms.MenuItem menuItemRedo;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.ImageList imageList1;
		private System.Windows.Forms.ToolBarButton toolBarButton0;
		private System.Windows.Forms.ToolBarButton toolBarButton1;
		private System.Windows.Forms.ToolBarButton toolBarButton2;
		private System.Windows.Forms.ToolBarButton toolBarButton3;
		private System.Windows.Forms.ToolBarButton toolBarButton4;
		private System.Windows.Forms.ToolBarButton toolBarButton5;
		private System.Windows.Forms.ToolBarButton toolBarButton6;
		private System.Windows.Forms.ToolBarButton toolBarButton7;
		private System.Windows.Forms.ToolBarButton toolBarButton8;
		private System.Windows.Forms.ToolBarButton toolBarButtonSep1;
		private System.Windows.Forms.ToolBarButton toolBarButton9;
		private System.Windows.Forms.ToolBarButton toolBarButton10;
		private System.Windows.Forms.ToolBarButton toolBarButton11;
		private System.Windows.Forms.ToolBarButton toolBarButtonSep2;
		private System.Windows.Forms.ToolBarButton toolBarButton12;
		private System.Windows.Forms.ToolBarButton toolBarButton13;
		private System.Windows.Forms.ToolBarButton toolBarButton14;
		private System.Windows.Forms.ToolBarButton toolBarButtonSep3;
		private System.Windows.Forms.ToolBarButton toolBarButton15;
		private System.Windows.Forms.ImageList imageList2;
		private System.Windows.Forms.ToolBar toolBar2;
		private System.Windows.Forms.ToolBarButton toolBarButton21;
		private System.Windows.Forms.ToolBarButton toolBarButton22;
		private System.Windows.Forms.ToolBarButton toolBarButton23;
		private System.Windows.Forms.ToolBarButton toolBarButton24;
		private System.Windows.Forms.ToolBarButton toolBarButton25;
		private System.Windows.Forms.ToolBarButton toolBarButton26;
		private System.Windows.Forms.ToolBarButton toolBarButtonSep5;
		private System.Windows.Forms.ToolBarButton toolBarButton27;
		private System.Windows.Forms.ToolBarButton toolBarButton29;
		private System.Windows.Forms.ToolBarButton toolBarButton30;
		private System.Windows.Forms.ToolBarButton toolBarButton31;
		private System.Windows.Forms.ToolBarButton toolBarButton32;
		private System.Windows.Forms.ToolBarButton toolBarButton33;
		private System.Windows.Forms.ToolBarButton toolBarButton34;
		private System.Windows.Forms.ToolBarButton toolBarButton35;
		private System.Windows.Forms.ToolBarButton toolBarButton36;
		private System.Windows.Forms.ToolBarButton toolBarButton37;
		private System.Windows.Forms.ToolBarButton toolBarButton38;
		private System.Windows.Forms.ToolBarButton toolBarButton39;
		private System.Windows.Forms.ToolBarButton toolBarButton40;
		private System.Windows.Forms.ToolBarButton toolBarButton43;
		private System.Windows.Forms.ImageList imageList3;
		private System.Windows.Forms.ToolBar toolBar3;
		private System.Windows.Forms.ToolBarButton toolBarButton55;
		private System.Windows.Forms.ToolBarButton toolBarButton57;
		private System.Windows.Forms.MenuItem menuItemActivate;
		private System.Windows.Forms.MenuItem menuItemSelectAll;
		private System.Windows.Forms.MenuItem menuItemRotate;
		private System.Windows.Forms.MenuItem menuItemMinus90;
		private System.Windows.Forms.MenuItem menuItemPlus90;
		private System.Windows.Forms.MenuItem menuItem180;
		private System.Windows.Forms.MenuItem menuItemRedraw;
		private System.Windows.Forms.ToolBarButton toolBarButton59;
		private System.Windows.Forms.ToolBarButton toolBarButton42;
		private System.Windows.Forms.ToolBarButton toolBarButton60;
		private System.Windows.Forms.ToolBarButton toolBarButton63;
		private System.Windows.Forms.ToolBarButton toolBarButton67;
		private System.Windows.Forms.MenuItem menuItemGetObjectByName;
		private System.Windows.Forms.MenuItem menuItemGetAttributeByName;
		private System.Windows.Forms.MenuItem menuItemSetAttributeByName;
		private System.Windows.Forms.MenuItem menuItemNewPage;
		private System.Windows.Forms.MenuItem menuItemInitBlank;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem10;
		private System.Windows.Forms.MenuItem menuItemAppendPage;
		private System.Windows.Forms.MenuItem menuItemDuplicatePage;
		private System.Windows.Forms.MenuItem menuItemDeletePage;
		private System.Windows.Forms.ToolBarButton toolBarButton68;
		private System.Windows.Forms.ToolBarButton toolBarButton28;
		private System.Windows.Forms.MenuItem menuItemMovePage;
		private System.Windows.Forms.ToolBarButton toolBarButtonNew;
		private System.Windows.Forms.ToolBarButton toolBarButtonOpen;
		private System.Windows.Forms.ToolBarButton toolBarButtonSave;
		private System.Windows.Forms.ToolBarButton toolBarButtonPrint;
		private System.Windows.Forms.ToolBarButton toolBarButtonCut;
		private System.Windows.Forms.ToolBarButton toolBarButtonCopy;
		private System.Windows.Forms.ToolBarButton toolBarButtonPaste;
		private System.Windows.Forms.ToolBarButton toolBarButtonUndo;
		private System.Windows.Forms.ToolBarButton toolBarButtonRedo;
		private System.Windows.Forms.ToolBarButton toolBarButtonPageView;
		private System.Windows.Forms.ToolBarButton toolBarButtonTableView;
		private System.Windows.Forms.ToolBarButton toolBarButtonGridView;
		private System.Windows.Forms.ToolBarButton toolBarButtonZoomOut;
		private System.Windows.Forms.ToolBarButton toolBarButtonSeparator;
		private System.Windows.Forms.ToolBarButton toolBarButtonRotateLeft;
		private System.Windows.Forms.ToolBarButton toolBarButtonRotateRight;
		private System.Windows.Forms.MenuItem menuItemStartPrint;
		private System.Windows.Forms.MenuItem menuItemPrintPage;
		private System.Windows.Forms.MenuItem menuItemEndPrint;
		private System.Windows.Forms.MenuItem menuItemCut;
		private System.Windows.Forms.MenuItem menuItemCopy;
		private System.Windows.Forms.MenuItem menuItemPaste;
		private System.Windows.Forms.MenuItem menuItemHelp;
		private System.Windows.Forms.MenuItem menuItemAbout;
		private System.Windows.Forms.ToolBarButton toolBarButtonSep16;
		private System.Windows.Forms.ToolBarButton toolBarButtonZoomIn;
		private System.Windows.Forms.StatusBar statusBar1;
		public System.Windows.Forms.StatusBarPanel statusBarPanel1;
		private System.Windows.Forms.MenuItem menuItemFind;
		private System.Windows.Forms.MenuItem menuItemReplace;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItemExportAs;
		private System.Windows.Forms.MenuItem menuItemDeleteObject;
		private System.Windows.Forms.MenuItem menuItemScrollIntoView;
		private System.Windows.Forms.MenuItem menuItemEdit;
		private System.Windows.Forms.MenuItem menuItemObject;
		private System.Windows.Forms.MenuItem menuItemPage;
		private System.Windows.Forms.ToolBar toolBar1;
		private bool m_cut = false;
		private bool m_copy = false;
		private bool m_doc = false;
		private System.Windows.Forms.MenuItem menuItemSaveAs;
		private System.Windows.Forms.MenuItem menuItemObjectCount;
		private System.Windows.Forms.MenuItem menuItemClear;
		private System.Windows.Forms.MenuItem menuItemCreateObject;
		private System.Windows.Forms.MenuItem menuItemPageFormat;
		private System.Windows.Forms.MenuItem menuItemObjectByXY;
		private Amyuni.PDFCreator.IacBookmarkView bookmarkView;
		private System.Windows.Forms.ToolBarButton toolBarButtonDocSettings;
		private string m_filename = null;
		private Amyuni.PDFCreator.PDFCreator pdfCreator;
		private System.Windows.Forms.Panel panelLeftPane;
		private System.Windows.Forms.TabControl tabLeftPane;
		private Amyuni.PDFCreator.IacThumbnailView thumbnailView;

		private PDFCreatorApp.PropertiesForm	m_propertiesForm = null;
		private PDFCreatorApp.DocSettingsForm	m_docSettingsForm = null;
		private PDFCreatorApp.GridForm			m_gridForm = null;
        private ToolBarButton toolBarButtonPanningMode;
        private ToolBarButton toolBarButtonRunMode;
		private System.Windows.Forms.ToolBarButton toolBarButtonDesignView;
		

		public AppForm()
		{
			InitializeComponent();

            pdfCreator.SetLicenseKey("Pre-release 1 - Not For Resale", "07EFCDAB01000100D1167061ACBDEF1C4E366B074E9E4E7BC27741E10912793845DEEF5484ABCADD87690546");

			this.pdfCreator.Parent = this;

			pdfCreator.FireBeforeDelete += new Amyuni.PDFCreator.OnFireBeforeDeleteDelegate(pdfControl_FireBeforeDelete);
			pdfCreator.FireRefresh += new Amyuni.PDFCreator.OnFireRefreshDelegate(pdfControl_FireRefresh);
			pdfCreator.FireClickHyperlink += new Amyuni.PDFCreator.OnFireClickHyperlinkDelegate(pdfControl_FireClickHyperlink);
			pdfCreator.FirePrintPage += new Amyuni.PDFCreator.OnFirePrintPageDelegate(pdfControl_FirePrintPage);
			pdfCreator.FireActivateObject += new Amyuni.PDFCreator.OnFireActivateObjectDelegate(pdfControl_FireActivateObject);
			pdfCreator.FireContextSensitiveMenu += new Amyuni.PDFCreator.OnFireContextSensitiveMenuDelegate(pdfControl_FireContextSensitiveMenu);
			pdfCreator.FireLoadPage += new Amyuni.PDFCreator.OnFireLoadPageDelegate(pdfControl_FireLoadPage);
			pdfCreator.FireMouseDown += new Amyuni.PDFCreator.OnFireMouseDownDelegate(pdfControl_FireMouseDown);
            pdfCreator.FireMouseRightButtonDown += new Amyuni.PDFCreator.OnFireMouseRightButtonDownDelegate(pdfControl_FireMouseRightButtonDown);
			pdfCreator.FireMouseMove +=new Amyuni.PDFCreator.OnFireMouseMoveDelegate(pdfControl_FireMouseMove);
			pdfCreator.FireMouseUp += new Amyuni.PDFCreator.OnFireMouseUpDelegate(pdfControl_FireMouseUp);
			pdfCreator.FireNewObject += new Amyuni.PDFCreator.OnFireNewObjectDelegate(pdfControl_FireNewObject);
			pdfCreator.FireObjectTextChange +=new Amyuni.PDFCreator.OnFireObjectTextChangeDelegate(pdfControl_FireObjectTextChange);
			pdfCreator.FireSavePage += new Amyuni.PDFCreator.OnFireSavePageDelegate(pdfControl_FireSavePage);
			pdfCreator.FireSelectedObjectChange2 += new Amyuni.PDFCreator.OnFireSelectedObjectChange2Delegate(pdfControl_FireSelectedObjectChange2);
			pdfCreator.FireSelectedObjectChange += new Amyuni.PDFCreator.OnFireSelectedObjectChangeDelegate(pdfCreator_FireSelectedObjectChange);
			pdfCreator.FireEvaluateExpression += new Amyuni.PDFCreator.OnFireEvaluateExpressionDelegate(pdfControl_FireEvaluateExpression);
			pdfCreator.FireProcessingProgress += new Amyuni.PDFCreator.OnFireProcessingProgressDelegate(pdfControl_FireProcessingProgress);

			// pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolDesignMode);
			EnableToolbars(false);
			toolBar2.Buttons[5].Pushed = true;
			pdfCreator.Enabled = false;
			this.TransparencyKey = System.Drawing.Color.Silver;
			
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
			    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(AppForm));
            System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();
            this.toolBar1 = new System.Windows.Forms.ToolBar();
            this.toolBarButton0 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton2 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton3 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton4 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton5 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton6 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton7 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton8 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonSep1 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton9 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton10 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton11 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonSep2 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton12 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton13 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton14 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonSep3 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton15 = new System.Windows.Forms.ToolBarButton();
            this.imageList1 = new System.Windows.Forms.ImageList(this.components);
            this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
            this.menuItemFile = new System.Windows.Forms.MenuItem();
            this.menuItemInitBlank = new System.Windows.Forms.MenuItem();
            this.menuItemFileOpen = new System.Windows.Forms.MenuItem();
            this.menuItem1 = new System.Windows.Forms.MenuItem();
            this.menuItemSave = new System.Windows.Forms.MenuItem();
            this.menuItemSaveAs = new System.Windows.Forms.MenuItem();
            this.menuItemStartSave = new System.Windows.Forms.MenuItem();
            this.menuItemSavePage = new System.Windows.Forms.MenuItem();
            this.menuItemEndSave = new System.Windows.Forms.MenuItem();
            this.menuItemExportAs = new System.Windows.Forms.MenuItem();
            this.menuItem5 = new System.Windows.Forms.MenuItem();
            this.menuItemPrint = new System.Windows.Forms.MenuItem();
            this.menuItemStartPrint = new System.Windows.Forms.MenuItem();
            this.menuItemPrintPage = new System.Windows.Forms.MenuItem();
            this.menuItemEndPrint = new System.Windows.Forms.MenuItem();
            this.menuItem3 = new System.Windows.Forms.MenuItem();
            this.menuItemExit = new System.Windows.Forms.MenuItem();
            this.menuItemEdit = new System.Windows.Forms.MenuItem();
            this.menuItemUndo = new System.Windows.Forms.MenuItem();
            this.menuItemRedo = new System.Windows.Forms.MenuItem();
            this.menuItem10 = new System.Windows.Forms.MenuItem();
            this.menuItemCut = new System.Windows.Forms.MenuItem();
            this.menuItemCopy = new System.Windows.Forms.MenuItem();
            this.menuItemPaste = new System.Windows.Forms.MenuItem();
            this.menuItem4 = new System.Windows.Forms.MenuItem();
            this.menuItemFind = new System.Windows.Forms.MenuItem();
            this.menuItemReplace = new System.Windows.Forms.MenuItem();
            this.menuItem2 = new System.Windows.Forms.MenuItem();
            this.menuItemSelectAll = new System.Windows.Forms.MenuItem();
            this.menuItemObject = new System.Windows.Forms.MenuItem();
            this.menuItemGetObjectByName = new System.Windows.Forms.MenuItem();
            this.menuItemObjectByXY = new System.Windows.Forms.MenuItem();
            this.menuItemGetAttributeByName = new System.Windows.Forms.MenuItem();
            this.menuItemSetAttributeByName = new System.Windows.Forms.MenuItem();
            this.menuItemActivate = new System.Windows.Forms.MenuItem();
            this.menuItemRedraw = new System.Windows.Forms.MenuItem();
            this.menuItemScrollIntoView = new System.Windows.Forms.MenuItem();
            this.menuItemDeleteObject = new System.Windows.Forms.MenuItem();
            this.menuItemPage = new System.Windows.Forms.MenuItem();
            this.menuItemNewPage = new System.Windows.Forms.MenuItem();
            this.menuItemAppendPage = new System.Windows.Forms.MenuItem();
            this.menuItemDuplicatePage = new System.Windows.Forms.MenuItem();
            this.menuItemRotate = new System.Windows.Forms.MenuItem();
            this.menuItemMinus90 = new System.Windows.Forms.MenuItem();
            this.menuItemPlus90 = new System.Windows.Forms.MenuItem();
            this.menuItem180 = new System.Windows.Forms.MenuItem();
            this.menuItemMovePage = new System.Windows.Forms.MenuItem();
            this.menuItemCreateObject = new System.Windows.Forms.MenuItem();
            this.menuItemObjectCount = new System.Windows.Forms.MenuItem();
            this.menuItemClear = new System.Windows.Forms.MenuItem();
            this.menuItemPageFormat = new System.Windows.Forms.MenuItem();
            this.menuItemDeletePage = new System.Windows.Forms.MenuItem();
            this.menuItemHelp = new System.Windows.Forms.MenuItem();
            this.menuItemAbout = new System.Windows.Forms.MenuItem();
            this.imageList2 = new System.Windows.Forms.ImageList(this.components);
            this.toolBar2 = new System.Windows.Forms.ToolBar();
            this.toolBarButton21 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton22 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton23 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton24 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonSep5 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton25 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton26 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton27 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton42 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton60 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton29 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton30 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton31 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton32 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton28 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton33 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton34 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton35 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton36 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton37 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton38 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton39 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton59 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton40 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton68 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton43 = new System.Windows.Forms.ToolBarButton();
            this.imageList3 = new System.Windows.Forms.ImageList(this.components);
            this.toolBar3 = new System.Windows.Forms.ToolBar();
            this.toolBarButtonNew = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonOpen = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonSave = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton63 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonPrint = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton55 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonCut = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonCopy = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonPaste = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton67 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonUndo = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonRedo = new System.Windows.Forms.ToolBarButton();
            this.toolBarButton57 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonPageView = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonTableView = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonGridView = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonSep16 = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonZoomOut = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonZoomIn = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonSeparator = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonRotateLeft = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonRotateRight = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonDesignView = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonDocSettings = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonPanningMode = new System.Windows.Forms.ToolBarButton();
            this.toolBarButtonRunMode = new System.Windows.Forms.ToolBarButton();
            this.statusBar1 = new System.Windows.Forms.StatusBar();
            this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
            this.bookmarkView = new Amyuni.PDFCreator.IacBookmarkView();
            this.panelLeftPane = new System.Windows.Forms.Panel();
            this.thumbnailView = new Amyuni.PDFCreator.IacThumbnailView();
            this.tabLeftPane = new System.Windows.Forms.TabControl();
            this.pdfCreator = new Amyuni.PDFCreator.PDFCreator();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
            this.panelLeftPane.SuspendLayout();
            this.SuspendLayout();
            // 
            // toolBar1
            // 
            this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
            this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
            this.toolBarButton0,
            this.toolBarButton1,
            this.toolBarButton2,
            this.toolBarButton3,
            this.toolBarButton4,
            this.toolBarButton5,
            this.toolBarButton6,
            this.toolBarButton7,
            this.toolBarButton8,
            this.toolBarButtonSep1,
            this.toolBarButton9,
            this.toolBarButton10,
            this.toolBarButton11,
            this.toolBarButtonSep2,
            this.toolBarButton12,
            this.toolBarButton13,
            this.toolBarButton14,
            this.toolBarButtonSep3,
            this.toolBarButton15});
            this.toolBar1.ButtonSize = new System.Drawing.Size(16, 16);
            this.toolBar1.Divider = false;
            this.toolBar1.Dock = System.Windows.Forms.DockStyle.None;
            this.toolBar1.DropDownArrows = true;
            this.toolBar1.ImageList = this.imageList1;
            this.toolBar1.Location = new System.Drawing.Point(0, 74);
            this.toolBar1.Name = "toolBar1";
            this.toolBar1.ShowToolTips = true;
            this.toolBar1.Size = new System.Drawing.Size(31, 422);
            this.toolBar1.TabIndex = 2;
            this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
            // 
            // toolBarButton0
            // 
            this.toolBarButton0.ImageIndex = 0;
            this.toolBarButton0.Name = "toolBarButton0";
            this.toolBarButton0.ToolTipText = "Select";
            // 
            // toolBarButton1
            // 
            this.toolBarButton1.ImageIndex = 1;
            this.toolBarButton1.Name = "toolBarButton1";
            this.toolBarButton1.ToolTipText = "Label";
            // 
            // toolBarButton2
            // 
            this.toolBarButton2.ImageIndex = 2;
            this.toolBarButton2.Name = "toolBarButton2";
            this.toolBarButton2.ToolTipText = "Line";
            // 
            // toolBarButton3
            // 
            this.toolBarButton3.ImageIndex = 3;
            this.toolBarButton3.Name = "toolBarButton3";
            this.toolBarButton3.ToolTipText = "Frame";
            // 
            // toolBarButton4
            // 
            this.toolBarButton4.ImageIndex = 4;
            this.toolBarButton4.Name = "toolBarButton4";
            this.toolBarButton4.ToolTipText = "Round Frame";
            // 
            // toolBarButton5
            // 
            this.toolBarButton5.ImageIndex = 5;
            this.toolBarButton5.Name = "toolBarButton5";
            this.toolBarButton5.ToolTipText = "Ellipse";
            // 
            // toolBarButton6
            // 
            this.toolBarButton6.ImageIndex = 6;
            this.toolBarButton6.Name = "toolBarButton6";
            this.toolBarButton6.ToolTipText = "Polygon";
            // 
            // toolBarButton7
            // 
            this.toolBarButton7.ImageIndex = 7;
            this.toolBarButton7.Name = "toolBarButton7";
            this.toolBarButton7.ToolTipText = "Freehand";
            // 
            // toolBarButton8
            // 
            this.toolBarButton8.ImageIndex = 8;
            this.toolBarButton8.Name = "toolBarButton8";
            this.toolBarButton8.ToolTipText = "Image";
            // 
            // toolBarButtonSep1
            // 
            this.toolBarButtonSep1.Enabled = false;
            this.toolBarButtonSep1.Name = "toolBarButtonSep1";
            this.toolBarButtonSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButton9
            // 
            this.toolBarButton9.ImageIndex = 9;
            this.toolBarButton9.Name = "toolBarButton9";
            this.toolBarButton9.ToolTipText = "Note";
            // 
            // toolBarButton10
            // 
            this.toolBarButton10.ImageIndex = 10;
            this.toolBarButton10.Name = "toolBarButton10";
            this.toolBarButton10.ToolTipText = "Hightlighter";
            // 
            // toolBarButton11
            // 
            this.toolBarButton11.ImageIndex = 11;
            this.toolBarButton11.Name = "toolBarButton11";
            this.toolBarButton11.ToolTipText = "Arrow";
            // 
            // toolBarButtonSep2
            // 
            this.toolBarButtonSep2.Name = "toolBarButtonSep2";
            this.toolBarButtonSep2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButton12
            // 
            this.toolBarButton12.ImageIndex = 12;
            this.toolBarButton12.Name = "toolBarButton12";
            this.toolBarButton12.ToolTipText = "Field";
            // 
            // toolBarButton13
            // 
            this.toolBarButton13.ImageIndex = 13;
            this.toolBarButton13.Name = "toolBarButton13";
            this.toolBarButton13.ToolTipText = "Button";
            // 
            // toolBarButton14
            // 
            this.toolBarButton14.ImageIndex = 14;
            this.toolBarButton14.Name = "toolBarButton14";
            this.toolBarButton14.ToolTipText = "Selection";
            // 
            // toolBarButtonSep3
            // 
            this.toolBarButtonSep3.Name = "toolBarButtonSep3";
            this.toolBarButtonSep3.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButton15
            // 
            this.toolBarButton15.ImageIndex = 15;
            this.toolBarButton15.Name = "toolBarButton15";
            this.toolBarButton15.ToolTipText = "Table";
            // 
            // imageList1
            // 
            this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
            this.imageList1.TransparentColor = System.Drawing.Color.Silver;
            this.imageList1.Images.SetKeyName(0, "");
            this.imageList1.Images.SetKeyName(1, "");
            this.imageList1.Images.SetKeyName(2, "");
            this.imageList1.Images.SetKeyName(3, "");
            this.imageList1.Images.SetKeyName(4, "");
            this.imageList1.Images.SetKeyName(5, "");
            this.imageList1.Images.SetKeyName(6, "");
            this.imageList1.Images.SetKeyName(7, "");
            this.imageList1.Images.SetKeyName(8, "");
            this.imageList1.Images.SetKeyName(9, "");
            this.imageList1.Images.SetKeyName(10, "");
            this.imageList1.Images.SetKeyName(11, "");
            this.imageList1.Images.SetKeyName(12, "");
            this.imageList1.Images.SetKeyName(13, "");
            this.imageList1.Images.SetKeyName(14, "");
            this.imageList1.Images.SetKeyName(15, "");
            this.imageList1.Images.SetKeyName(16, "");
            this.imageList1.Images.SetKeyName(17, "");
            this.imageList1.Images.SetKeyName(18, "");
            this.imageList1.Images.SetKeyName(19, "");
            this.imageList1.Images.SetKeyName(20, "");
            // 
            // mainMenu1
            // 
            this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItemFile,
            this.menuItemEdit,
            this.menuItemObject,
            this.menuItemPage,
            this.menuItemHelp});
            // 
            // menuItemFile
            // 
            this.menuItemFile.Index = 0;
            this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItemInitBlank,
            this.menuItemFileOpen,
            this.menuItem1,
            this.menuItemSave,
            this.menuItemSaveAs,
            this.menuItemStartSave,
            this.menuItemSavePage,
            this.menuItemEndSave,
            this.menuItemExportAs,
            this.menuItem5,
            this.menuItemPrint,
            this.menuItemStartPrint,
            this.menuItemPrintPage,
            this.menuItemEndPrint,
            this.menuItem3,
            this.menuItemExit});
            this.menuItemFile.Text = "&File";
            this.menuItemFile.Popup += new System.EventHandler(this.menuItemFile_Popup);
            // 
            // menuItemInitBlank
            // 
            this.menuItemInitBlank.Index = 0;
            this.menuItemInitBlank.Text = "&New";
            this.menuItemInitBlank.Click += new System.EventHandler(this.menuItemInitBlank_Click);
            // 
            // menuItemFileOpen
            // 
            this.menuItemFileOpen.Index = 1;
            this.menuItemFileOpen.Text = "&Open...";
            this.menuItemFileOpen.Click += new System.EventHandler(this.menuItemFileOpen_Click);
            // 
            // menuItem1
            // 
            this.menuItem1.Index = 2;
            this.menuItem1.Text = "-";
            // 
            // menuItemSave
            // 
            this.menuItemSave.Index = 3;
            this.menuItemSave.Text = "&Save";
            this.menuItemSave.Click += new System.EventHandler(this.menuItemSave_Click);
            // 
            // menuItemSaveAs
            // 
            this.menuItemSaveAs.Index = 4;
            this.menuItemSaveAs.Text = "Save As...";
            this.menuItemSaveAs.Click += new System.EventHandler(this.menuItemSaveAs_Click);
            // 
            // menuItemStartSave
            // 
            this.menuItemStartSave.Index = 5;
            this.menuItemStartSave.Text = "S&tart Save";
            this.menuItemStartSave.Click += new System.EventHandler(this.menuItemStartSave_Click);
            // 
            // menuItemSavePage
            // 
            this.menuItemSavePage.Index = 6;
            this.menuItemSavePage.Text = "Sa&ve Page";
            this.menuItemSavePage.Click += new System.EventHandler(this.menuItemSavePage_Click);
            // 
            // menuItemEndSave
            // 
            this.menuItemEndSave.Index = 7;
            this.menuItemEndSave.Text = "&End Save";
            this.menuItemEndSave.Click += new System.EventHandler(this.menuItemEndSave_Click);
            // 
            // menuItemExportAs
            // 
            this.menuItemExportAs.Index = 8;
            this.menuItemExportAs.Text = "E&xport As...";
            this.menuItemExportAs.Click += new System.EventHandler(this.menuItemExportAs_Click);
            // 
            // menuItem5
            // 
            this.menuItem5.Index = 9;
            this.menuItem5.Text = "-";
            // 
            // menuItemPrint
            // 
            this.menuItemPrint.Index = 10;
            this.menuItemPrint.Text = "&Print...";
            this.menuItemPrint.Click += new System.EventHandler(this.menuItemPrint_Click);
            // 
            // menuItemStartPrint
            // 
            this.menuItemStartPrint.Index = 11;
            this.menuItemStartPrint.Text = "St&art Print";
            this.menuItemStartPrint.Click += new System.EventHandler(this.menuItemStartPrint_Click);
            // 
            // menuItemPrintPage
            // 
            this.menuItemPrintPage.Index = 12;
            this.menuItemPrintPage.Text = "P&rint Page";
            this.menuItemPrintPage.Click += new System.EventHandler(this.menuItemPrintPage_Click);
            // 
            // menuItemEndPrint
            // 
            this.menuItemEndPrint.Index = 13;
            this.menuItemEndPrint.Text = "E&nd Print";
            this.menuItemEndPrint.Click += new System.EventHandler(this.menuItemEndPrint_Click);
            // 
            // menuItem3
            // 
            this.menuItem3.Index = 14;
            this.menuItem3.Text = "-";
            // 
            // menuItemExit
            // 
            this.menuItemExit.Index = 15;
            this.menuItemExit.Text = "E&xit";
            this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click);
            // 
            // menuItemEdit
            // 
            this.menuItemEdit.Index = 1;
            this.menuItemEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItemUndo,
            this.menuItemRedo,
            this.menuItem10,
            this.menuItemCut,
            this.menuItemCopy,
            this.menuItemPaste,
            this.menuItem4,
            this.menuItemFind,
            this.menuItemReplace,
            this.menuItem2,
            this.menuItemSelectAll});
            this.menuItemEdit.Text = "&Edit";
            this.menuItemEdit.Popup += new System.EventHandler(this.menuItemEdit_Popup);
            // 
            // menuItemUndo
            // 
            this.menuItemUndo.Index = 0;
            this.menuItemUndo.Text = "&Undo";
            this.menuItemUndo.Click += new System.EventHandler(this.menuItemUndo_Click);
            // 
            // menuItemRedo
            // 
            this.menuItemRedo.Index = 1;
            this.menuItemRedo.Text = "&Redo";
            this.menuItemRedo.Click += new System.EventHandler(this.menuItemRedo_Click);
            // 
            // menuItem10
            // 
            this.menuItem10.Index = 2;
            this.menuItem10.Text = "-";
            // 
            // menuItemCut
            // 
            this.menuItemCut.Index = 3;
            this.menuItemCut.Text = "Cu&t";
            this.menuItemCut.Click += new System.EventHandler(this.menuItemCut_Click);
            // 
            // menuItemCopy
            // 
            this.menuItemCopy.Index = 4;
            this.menuItemCopy.Text = "&Copy";
            this.menuItemCopy.Click += new System.EventHandler(this.menuItemCopy_Click);
            // 
            // menuItemPaste
            // 
            this.menuItemPaste.Index = 5;
            this.menuItemPaste.Text = "&Paste";
            this.menuItemPaste.Click += new System.EventHandler(this.menuItemPaste_Click);
            // 
            // menuItem4
            // 
            this.menuItem4.Index = 6;
            this.menuItem4.Text = "-";
            // 
            // menuItemFind
            // 
            this.menuItemFind.Index = 7;
            this.menuItemFind.Text = "Find...";
            this.menuItemFind.Click += new System.EventHandler(this.menuItemFind_Click);
            // 
            // menuItemReplace
            // 
            this.menuItemReplace.Index = 8;
            this.menuItemReplace.Text = "Replace...";
            this.menuItemReplace.Click += new System.EventHandler(this.menuItemReplace_Click);
            // 
            // menuItem2
            // 
            this.menuItem2.Index = 9;
            this.menuItem2.Text = "-";
            // 
            // menuItemSelectAll
            // 
            this.menuItemSelectAll.Index = 10;
            this.menuItemSelectAll.Text = "Select &All";
            this.menuItemSelectAll.Click += new System.EventHandler(this.menuItemSelectAll_Click);
            // 
            // menuItemObject
            // 
            this.menuItemObject.Index = 2;
            this.menuItemObject.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItemGetObjectByName,
            this.menuItemObjectByXY,
            this.menuItemGetAttributeByName,
            this.menuItemSetAttributeByName,
            this.menuItemActivate,
            this.menuItemRedraw,
            this.menuItemScrollIntoView,
            this.menuItemDeleteObject});
            this.menuItemObject.Text = "&Object";
            this.menuItemObject.Popup += new System.EventHandler(this.menuItemObject_Popup);
            // 
            // menuItemGetObjectByName
            // 
            this.menuItemGetObjectByName.Index = 0;
            this.menuItemGetObjectByName.Text = "Get&ObjectByName...";
            this.menuItemGetObjectByName.Click += new System.EventHandler(this.menuItemGetObjectByName_Click);
            // 
            // menuItemObjectByXY
            // 
            this.menuItemObjectByXY.Index = 1;
            this.menuItemObjectByXY.Text = "GetObjectBy&XY...";
            this.menuItemObjectByXY.Click += new System.EventHandler(this.menuItemObjectByXY_Click);
            // 
            // menuItemGetAttributeByName
            // 
            this.menuItemGetAttributeByName.Index = 2;
            this.menuItemGetAttributeByName.Text = "Get&Attribute...";
            this.menuItemGetAttributeByName.Click += new System.EventHandler(this.menuItemGetAttributeByName_Click);
            // 
            // menuItemSetAttributeByName
            // 
            this.menuItemSetAttributeByName.Index = 3;
            this.menuItemSetAttributeByName.Text = "SetA&ttribute...";
            this.menuItemSetAttributeByName.Click += new System.EventHandler(this.menuItemSetAttributeByName_Click);
            // 
            // menuItemActivate
            // 
            this.menuItemActivate.Index = 4;
            this.menuItemActivate.Text = "Acti&vate...";
            this.menuItemActivate.Click += new System.EventHandler(this.menuItemActivate_Click);
            // 
            // menuItemRedraw
            // 
            this.menuItemRedraw.Index = 5;
            this.menuItemRedraw.Text = "&Redraw...";
            this.menuItemRedraw.Click += new System.EventHandler(this.menuItemRedraw_Click);
            // 
            // menuItemScrollIntoView
            // 
            this.menuItemScrollIntoView.Index = 6;
            this.menuItemScrollIntoView.Text = "&ScrollIntoView...";
            this.menuItemScrollIntoView.Click += new System.EventHandler(this.menuItemScrollIntoView_Click);
            // 
            // menuItemDeleteObject
            // 
            this.menuItemDeleteObject.Index = 7;
            this.menuItemDeleteObject.Text = "&Delete...";
            this.menuItemDeleteObject.Click += new System.EventHandler(this.menuItemDeleteObject_Click);
            // 
            // menuItemPage
            // 
            this.menuItemPage.Index = 3;
            this.menuItemPage.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItemNewPage,
            this.menuItemAppendPage,
            this.menuItemDuplicatePage,
            this.menuItemRotate,
            this.menuItemMovePage,
            this.menuItemCreateObject,
            this.menuItemObjectCount,
            this.menuItemClear,
            this.menuItemPageFormat,
            this.menuItemDeletePage});
            this.menuItemPage.Text = "&Page";
            this.menuItemPage.Popup += new System.EventHandler(this.menuItemPage_Popup);
            // 
            // menuItemNewPage
            // 
            this.menuItemNewPage.Index = 0;
            this.menuItemNewPage.Text = "&New";
            this.menuItemNewPage.Click += new System.EventHandler(this.menuItemNewPage_Click);
            // 
            // menuItemAppendPage
            // 
            this.menuItemAppendPage.Index = 1;
            this.menuItemAppendPage.Text = "&Append";
            this.menuItemAppendPage.Click += new System.EventHandler(this.menuItemAppendPage_Click);
            // 
            // menuItemDuplicatePage
            // 
            this.menuItemDuplicatePage.Index = 2;
            this.menuItemDuplicatePage.Text = "&Duplicate";
            this.menuItemDuplicatePage.Click += new System.EventHandler(this.menuItemDuplicatePage_Click);
            // 
            // menuItemRotate
            // 
            this.menuItemRotate.Index = 3;
            this.menuItemRotate.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItemMinus90,
            this.menuItemPlus90,
            this.menuItem180});
            this.menuItemRotate.Text = "&Rotate";
            this.menuItemRotate.Click += new System.EventHandler(this.menuItemRotate_Click);
            // 
            // menuItemMinus90
            // 
            this.menuItemMinus90.Index = 0;
            this.menuItemMinus90.Text = "-90";
            this.menuItemMinus90.Click += new System.EventHandler(this.menuItemMinus90_Click);
            // 
            // menuItemPlus90
            // 
            this.menuItemPlus90.Index = 1;
            this.menuItemPlus90.Text = "90";
            this.menuItemPlus90.Click += new System.EventHandler(this.menuItemPlus90_Click);
            // 
            // menuItem180
            // 
            this.menuItem180.Index = 2;
            this.menuItem180.Text = "180";
            this.menuItem180.Click += new System.EventHandler(this.menuItem180_Click);
            // 
            // menuItemMovePage
            // 
            this.menuItemMovePage.Index = 4;
            this.menuItemMovePage.Text = "&Move...";
            this.menuItemMovePage.Click += new System.EventHandler(this.menuItemMovePage_Click);
            // 
            // menuItemCreateObject
            // 
            this.menuItemCreateObject.Index = 5;
            this.menuItemCreateObject.Text = "&CreateObject...";
            this.menuItemCreateObject.Click += new System.EventHandler(this.menuItemCreateObject_Click);
            // 
            // menuItemObjectCount
            // 
            this.menuItemObjectCount.Index = 6;
            this.menuItemObjectCount.Text = "&ObjectCount";
            this.menuItemObjectCount.Click += new System.EventHandler(this.menuItemObjectCount_Click);
            // 
            // menuItemClear
            // 
            this.menuItemClear.Index = 7;
            this.menuItemClear.Text = "C&lear";
            this.menuItemClear.Click += new System.EventHandler(this.menuItemClear_Click);
            // 
            // menuItemPageFormat
            // 
            this.menuItemPageFormat.Index = 8;
            this.menuItemPageFormat.Text = "Page&Format";
            this.menuItemPageFormat.Click += new System.EventHandler(this.menuItemPageFormat_Click);
            // 
            // menuItemDeletePage
            // 
            this.menuItemDeletePage.Index = 9;
            this.menuItemDeletePage.Text = "&Delete";
            this.menuItemDeletePage.Click += new System.EventHandler(this.menuItemDeletePage_Click);
            // 
            // menuItemHelp
            // 
            this.menuItemHelp.Index = 4;
            this.menuItemHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItemAbout});
            this.menuItemHelp.Text = "&Help";
            // 
            // menuItemAbout
            // 
            this.menuItemAbout.Index = 0;
            this.menuItemAbout.Text = "&About...";
            this.menuItemAbout.Click += new System.EventHandler(this.menuItemAbout_Click);
            // 
            // imageList2
            // 
            this.imageList2.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList2.ImageStream")));
            this.imageList2.TransparentColor = System.Drawing.Color.Silver;
            this.imageList2.Images.SetKeyName(0, "");
            this.imageList2.Images.SetKeyName(1, "");
            this.imageList2.Images.SetKeyName(2, "");
            this.imageList2.Images.SetKeyName(3, "");
            this.imageList2.Images.SetKeyName(4, "");
            this.imageList2.Images.SetKeyName(5, "");
            this.imageList2.Images.SetKeyName(6, "");
            this.imageList2.Images.SetKeyName(7, "");
            this.imageList2.Images.SetKeyName(8, "");
            this.imageList2.Images.SetKeyName(9, "");
            this.imageList2.Images.SetKeyName(10, "");
            this.imageList2.Images.SetKeyName(11, "");
            this.imageList2.Images.SetKeyName(12, "");
            this.imageList2.Images.SetKeyName(13, "");
            this.imageList2.Images.SetKeyName(14, "");
            this.imageList2.Images.SetKeyName(15, "");
            this.imageList2.Images.SetKeyName(16, "");
            this.imageList2.Images.SetKeyName(17, "");
            this.imageList2.Images.SetKeyName(18, "");
            this.imageList2.Images.SetKeyName(19, "");
            // 
            // toolBar2
            // 
            this.toolBar2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.toolBar2.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
            this.toolBar2.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
            this.toolBarButton21,
            this.toolBarButton22,
            this.toolBarButton23,
            this.toolBarButton24,
            this.toolBarButtonSep5,
            this.toolBarButton25,
            this.toolBarButton26,
            this.toolBarButton27,
            this.toolBarButton42,
            this.toolBarButton60,
            this.toolBarButton29,
            this.toolBarButton30,
            this.toolBarButton31,
            this.toolBarButton32,
            this.toolBarButton28,
            this.toolBarButton33,
            this.toolBarButton34,
            this.toolBarButton35,
            this.toolBarButton36,
            this.toolBarButton37,
            this.toolBarButton38,
            this.toolBarButton39,
            this.toolBarButton59,
            this.toolBarButton40,
            this.toolBarButton68,
            this.toolBarButton43});
            this.toolBar2.ButtonSize = new System.Drawing.Size(16, 16);
            this.toolBar2.Dock = System.Windows.Forms.DockStyle.None;
            this.toolBar2.DropDownArrows = true;
            this.toolBar2.ImageList = this.imageList2;
            this.toolBar2.Location = new System.Drawing.Point(0, 37);
            this.toolBar2.Name = "toolBar2";
            this.toolBar2.ShowToolTips = true;
            this.toolBar2.Size = new System.Drawing.Size(945, 28);
            this.toolBar2.TabIndex = 3;
            this.toolBar2.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar2_ButtonClick);
            // 
            // toolBarButton21
            // 
            this.toolBarButton21.ImageIndex = 0;
            this.toolBarButton21.Name = "toolBarButton21";
            this.toolBarButton21.ToolTipText = "Font";
            // 
            // toolBarButton22
            // 
            this.toolBarButton22.ImageIndex = 1;
            this.toolBarButton22.Name = "toolBarButton22";
            this.toolBarButton22.ToolTipText = "Bold";
            // 
            // toolBarButton23
            // 
            this.toolBarButton23.ImageIndex = 2;
            this.toolBarButton23.Name = "toolBarButton23";
            this.toolBarButton23.ToolTipText = "Italic";
            // 
            // toolBarButton24
            // 
            this.toolBarButton24.ImageIndex = 3;
            this.toolBarButton24.Name = "toolBarButton24";
            this.toolBarButton24.ToolTipText = "Underline";
            // 
            // toolBarButtonSep5
            // 
            this.toolBarButtonSep5.Name = "toolBarButtonSep5";
            this.toolBarButtonSep5.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButton25
            // 
            this.toolBarButton25.ImageIndex = 4;
            this.toolBarButton25.Name = "toolBarButton25";
            this.toolBarButton25.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
            this.toolBarButton25.ToolTipText = ((string)(configurationAppSettings.GetValue("toolBarButton25.ToolTipText", typeof(string))));
            // 
            // toolBarButton26
            // 
            this.toolBarButton26.ImageIndex = 5;
            this.toolBarButton26.Name = "toolBarButton26";
            this.toolBarButton26.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
            this.toolBarButton26.ToolTipText = "Center";
            // 
            // toolBarButton27
            // 
            this.toolBarButton27.ImageIndex = 6;
            this.toolBarButton27.Name = "toolBarButton27";
            this.toolBarButton27.ToolTipText = "Align Right";
            // 
            // toolBarButton42
            // 
            this.toolBarButton42.ImageIndex = 7;
            this.toolBarButton42.Name = "toolBarButton42";
            this.toolBarButton42.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
            this.toolBarButton42.ToolTipText = "Justify";
            // 
            // toolBarButton60
            // 
            this.toolBarButton60.Name = "toolBarButton60";
            this.toolBarButton60.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButton29
            // 
            this.toolBarButton29.ImageIndex = 8;
            this.toolBarButton29.Name = "toolBarButton29";
            this.toolBarButton29.ToolTipText = "Properties";
            // 
            // toolBarButton30
            // 
            this.toolBarButton30.Name = "toolBarButton30";
            this.toolBarButton30.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButton31
            // 
            this.toolBarButton31.ImageIndex = 9;
            this.toolBarButton31.Name = "toolBarButton31";
            this.toolBarButton31.ToolTipText = "Bring to Front";
            // 
            // toolBarButton32
            // 
            this.toolBarButton32.ImageIndex = 10;
            this.toolBarButton32.Name = "toolBarButton32";
            this.toolBarButton32.ToolTipText = "Send to Back";
            // 
            // toolBarButton28
            // 
            this.toolBarButton28.Name = "toolBarButton28";
            this.toolBarButton28.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButton33
            // 
            this.toolBarButton33.ImageIndex = 11;
            this.toolBarButton33.Name = "toolBarButton33";
            this.toolBarButton33.ToolTipText = "Align Lefts";
            // 
            // toolBarButton34
            // 
            this.toolBarButton34.ImageIndex = 12;
            this.toolBarButton34.Name = "toolBarButton34";
            this.toolBarButton34.ToolTipText = "Align Rights";
            // 
            // toolBarButton35
            // 
            this.toolBarButton35.ImageIndex = 13;
            this.toolBarButton35.Name = "toolBarButton35";
            this.toolBarButton35.ToolTipText = "Align Tops";
            // 
            // toolBarButton36
            // 
            this.toolBarButton36.ImageIndex = 14;
            this.toolBarButton36.Name = "toolBarButton36";
            this.toolBarButton36.ToolTipText = "Align Bottoms";
            // 
            // toolBarButton37
            // 
            this.toolBarButton37.ImageIndex = 15;
            this.toolBarButton37.Name = "toolBarButton37";
            this.toolBarButton37.ToolTipText = "Center Horizontal";
            // 
            // toolBarButton38
            // 
            this.toolBarButton38.ImageIndex = 16;
            this.toolBarButton38.Name = "toolBarButton38";
            this.toolBarButton38.ToolTipText = "Center Vertical";
            // 
            // toolBarButton39
            // 
            this.toolBarButton39.Name = "toolBarButton39";
            this.toolBarButton39.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButton59
            // 
            this.toolBarButton59.ImageIndex = 18;
            this.toolBarButton59.Name = "toolBarButton59";
            this.toolBarButton59.ToolTipText = "Make Same Heights";
            // 
            // toolBarButton40
            // 
            this.toolBarButton40.ImageIndex = 17;
            this.toolBarButton40.Name = "toolBarButton40";
            this.toolBarButton40.ToolTipText = "Make Same Widths";
            // 
            // toolBarButton68
            // 
            this.toolBarButton68.Name = "toolBarButton68";
            this.toolBarButton68.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButton43
            // 
            this.toolBarButton43.ImageIndex = 19;
            this.toolBarButton43.Name = "toolBarButton43";
            this.toolBarButton43.ToolTipText = "Grid Properties";
            // 
            // imageList3
            // 
            this.imageList3.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList3.ImageStream")));
            this.imageList3.TransparentColor = System.Drawing.Color.Lime;
            this.imageList3.Images.SetKeyName(0, "");
            this.imageList3.Images.SetKeyName(1, "");
            this.imageList3.Images.SetKeyName(2, "");
            this.imageList3.Images.SetKeyName(3, "");
            this.imageList3.Images.SetKeyName(4, "");
            this.imageList3.Images.SetKeyName(5, "");
            this.imageList3.Images.SetKeyName(6, "");
            this.imageList3.Images.SetKeyName(7, "");
            this.imageList3.Images.SetKeyName(8, "");
            this.imageList3.Images.SetKeyName(9, "");
            this.imageList3.Images.SetKeyName(10, "");
            this.imageList3.Images.SetKeyName(11, "");
            this.imageList3.Images.SetKeyName(12, "");
            this.imageList3.Images.SetKeyName(13, "");
            this.imageList3.Images.SetKeyName(14, "");
            this.imageList3.Images.SetKeyName(15, "");
            this.imageList3.Images.SetKeyName(16, "");
            this.imageList3.Images.SetKeyName(17, "");
            this.imageList3.Images.SetKeyName(18, "");
            this.imageList3.Images.SetKeyName(19, "");
            this.imageList3.Images.SetKeyName(20, "");
            // 
            // toolBar3
            // 
            this.toolBar3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.toolBar3.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
            this.toolBar3.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
            this.toolBarButtonNew,
            this.toolBarButtonOpen,
            this.toolBarButtonSave,
            this.toolBarButton63,
            this.toolBarButtonPrint,
            this.toolBarButton55,
            this.toolBarButtonCut,
            this.toolBarButtonCopy,
            this.toolBarButtonPaste,
            this.toolBarButton67,
            this.toolBarButtonUndo,
            this.toolBarButtonRedo,
            this.toolBarButton57,
            this.toolBarButtonPageView,
            this.toolBarButtonTableView,
            this.toolBarButtonGridView,
            this.toolBarButtonSep16,
            this.toolBarButtonZoomOut,
            this.toolBarButtonZoomIn,
            this.toolBarButtonSeparator,
            this.toolBarButtonRotateLeft,
            this.toolBarButtonRotateRight,
            this.toolBarButtonDesignView,
            this.toolBarButtonDocSettings,
            this.toolBarButtonPanningMode,
            this.toolBarButtonRunMode});
            this.toolBar3.ButtonSize = new System.Drawing.Size(20, 20);
            this.toolBar3.Dock = System.Windows.Forms.DockStyle.None;
            this.toolBar3.DropDownArrows = true;
            this.toolBar3.ImageList = this.imageList3;
            this.toolBar3.Location = new System.Drawing.Point(0, 0);
            this.toolBar3.Name = "toolBar3";
            this.toolBar3.ShowToolTips = true;
            this.toolBar3.Size = new System.Drawing.Size(944, 30);
            this.toolBar3.TabIndex = 4;
            this.toolBar3.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar3_ButtonClick);
            // 
            // toolBarButtonNew
            // 
            this.toolBarButtonNew.ImageIndex = 0;
            this.toolBarButtonNew.Name = "toolBarButtonNew";
            this.toolBarButtonNew.ToolTipText = "New";
            // 
            // toolBarButtonOpen
            // 
            this.toolBarButtonOpen.ImageIndex = 1;
            this.toolBarButtonOpen.Name = "toolBarButtonOpen";
            this.toolBarButtonOpen.ToolTipText = "Open";
            // 
            // toolBarButtonSave
            // 
            this.toolBarButtonSave.ImageIndex = 2;
            this.toolBarButtonSave.Name = "toolBarButtonSave";
            this.toolBarButtonSave.ToolTipText = "Save";
            // 
            // toolBarButton63
            // 
            this.toolBarButton63.Name = "toolBarButton63";
            this.toolBarButton63.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButtonPrint
            // 
            this.toolBarButtonPrint.ImageIndex = 3;
            this.toolBarButtonPrint.Name = "toolBarButtonPrint";
            this.toolBarButtonPrint.ToolTipText = "Print";
            // 
            // toolBarButton55
            // 
            this.toolBarButton55.Name = "toolBarButton55";
            this.toolBarButton55.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButtonCut
            // 
            this.toolBarButtonCut.ImageIndex = 13;
            this.toolBarButtonCut.Name = "toolBarButtonCut";
            this.toolBarButtonCut.ToolTipText = "Cut";
            // 
            // toolBarButtonCopy
            // 
            this.toolBarButtonCopy.ImageIndex = 14;
            this.toolBarButtonCopy.Name = "toolBarButtonCopy";
            this.toolBarButtonCopy.ToolTipText = "Copy";
            // 
            // toolBarButtonPaste
            // 
            this.toolBarButtonPaste.ImageIndex = 15;
            this.toolBarButtonPaste.Name = "toolBarButtonPaste";
            this.toolBarButtonPaste.ToolTipText = "Paste";
            // 
            // toolBarButton67
            // 
            this.toolBarButton67.Name = "toolBarButton67";
            this.toolBarButton67.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButtonUndo
            // 
            this.toolBarButtonUndo.ImageIndex = 4;
            this.toolBarButtonUndo.Name = "toolBarButtonUndo";
            this.toolBarButtonUndo.ToolTipText = "Undo";
            // 
            // toolBarButtonRedo
            // 
            this.toolBarButtonRedo.ImageIndex = 5;
            this.toolBarButtonRedo.Name = "toolBarButtonRedo";
            this.toolBarButtonRedo.ToolTipText = "Redo";
            // 
            // toolBarButton57
            // 
            this.toolBarButton57.Name = "toolBarButton57";
            this.toolBarButton57.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButtonPageView
            // 
            this.toolBarButtonPageView.ImageIndex = 6;
            this.toolBarButtonPageView.Name = "toolBarButtonPageView";
            this.toolBarButtonPageView.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
            this.toolBarButtonPageView.ToolTipText = "Page View";
            // 
            // toolBarButtonTableView
            // 
            this.toolBarButtonTableView.ImageIndex = 7;
            this.toolBarButtonTableView.Name = "toolBarButtonTableView";
            this.toolBarButtonTableView.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
            this.toolBarButtonTableView.ToolTipText = "Normal View";
            // 
            // toolBarButtonGridView
            // 
            this.toolBarButtonGridView.ImageIndex = 8;
            this.toolBarButtonGridView.Name = "toolBarButtonGridView";
            this.toolBarButtonGridView.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
            this.toolBarButtonGridView.ToolTipText = "View Grids";
            // 
            // toolBarButtonSep16
            // 
            this.toolBarButtonSep16.Name = "toolBarButtonSep16";
            this.toolBarButtonSep16.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButtonZoomOut
            // 
            this.toolBarButtonZoomOut.ImageIndex = 9;
            this.toolBarButtonZoomOut.Name = "toolBarButtonZoomOut";
            this.toolBarButtonZoomOut.ToolTipText = "Zoom Out";
            // 
            // toolBarButtonZoomIn
            // 
            this.toolBarButtonZoomIn.ImageIndex = 10;
            this.toolBarButtonZoomIn.Name = "toolBarButtonZoomIn";
            this.toolBarButtonZoomIn.ToolTipText = "Zoom In";
            // 
            // toolBarButtonSeparator
            // 
            this.toolBarButtonSeparator.Name = "toolBarButtonSeparator";
            this.toolBarButtonSeparator.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
            // 
            // toolBarButtonRotateLeft
            // 
            this.toolBarButtonRotateLeft.ImageIndex = 11;
            this.toolBarButtonRotateLeft.Name = "toolBarButtonRotateLeft";
            this.toolBarButtonRotateLeft.ToolTipText = "Rotate Left";
            // 
            // toolBarButtonRotateRight
            // 
            this.toolBarButtonRotateRight.ImageIndex = 12;
            this.toolBarButtonRotateRight.Name = "toolBarButtonRotateRight";
            this.toolBarButtonRotateRight.ToolTipText = "Rotate Right";
            // 
            // toolBarButtonDesignView
            // 
            this.toolBarButtonDesignView.ImageIndex = 18;
            this.toolBarButtonDesignView.Name = "toolBarButtonDesignView";
            this.toolBarButtonDesignView.ToolTipText = "Switch to Design View";
            // 
            // toolBarButtonDocSettings
            // 
            this.toolBarButtonDocSettings.ImageIndex = 20;
            this.toolBarButtonDocSettings.Name = "toolBarButtonDocSettings";
            this.toolBarButtonDocSettings.ToolTipText = "Document Settings";
            // 
            // toolBarButtonPanningMode
            // 
            this.toolBarButtonPanningMode.Name = "toolBarButtonPanningMode";
            this.toolBarButtonPanningMode.ToolTipText = "Panning Mode";
            // 
            // toolBarButtonRunMode
            // 
            this.toolBarButtonRunMode.Name = "toolBarButtonRunMode";
            this.toolBarButtonRunMode.ToolTipText = "Run Mode";
            // 
            // statusBar1
            // 
            this.statusBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.statusBar1.Dock = System.Windows.Forms.DockStyle.None;
            this.statusBar1.Location = new System.Drawing.Point(0, 588);
            this.statusBar1.Name = "statusBar1";
            this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
            this.statusBarPanel1});
            this.statusBar1.Size = new System.Drawing.Size(944, 28);
            this.statusBar1.TabIndex = 5;
            // 
            // statusBarPanel1
            // 
            this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
            this.statusBarPanel1.Name = "statusBarPanel1";
            this.statusBarPanel1.Text = "Ready";
            this.statusBarPanel1.Width = 97;
            // 
            // bookmarkView
            // 
            this.bookmarkView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.bookmarkView.Location = new System.Drawing.Point(2, 37);
            this.bookmarkView.Name = "bookmarkView";
            this.bookmarkView.ReadOnly = true;
            this.bookmarkView.Size = new System.Drawing.Size(255, 437);
            this.bookmarkView.TabIndex = 1;
            // 
            // panelLeftPane
            // 
            this.panelLeftPane.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left)));
            this.panelLeftPane.Controls.Add(this.thumbnailView);
            this.panelLeftPane.Controls.Add(this.bookmarkView);
            this.panelLeftPane.Controls.Add(this.tabLeftPane);
            this.panelLeftPane.Location = new System.Drawing.Point(48, 74);
            this.panelLeftPane.Name = "panelLeftPane";
            this.panelLeftPane.Size = new System.Drawing.Size(259, 477);
            this.panelLeftPane.TabIndex = 1;
            // 
            // thumbnailView
            // 
            this.thumbnailView.AllowDrop = true;
            this.thumbnailView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.thumbnailView.AutoScroll = true;
            this.thumbnailView.AutoScrollMargin = new System.Drawing.Size(0, 1);
            this.thumbnailView.BackColor = System.Drawing.Color.White;
            this.thumbnailView.Location = new System.Drawing.Point(2, 37);
            this.thumbnailView.Name = "thumbnailView";
            this.thumbnailView.PDF = null;
            this.thumbnailView.SelectedPages = new int[0];
            this.thumbnailView.Size = new System.Drawing.Size(255, 437);
            this.thumbnailView.TabIndex = 2;
            this.thumbnailView.ThumbSizeFactor = 14;
            this.thumbnailView.PageActivated += new Amyuni.PDFCreator.IacThumbnailView.PageActivatedEventHandler(this.thumbnailView_PageActivated);
            this.thumbnailView.DeleteSelectedPages += new Amyuni.PDFCreator.IacThumbnailView.DeleteSelectedPagesEventHandler(this.thumbnailView_DeleteSelectedPages);
            this.thumbnailView.PageSelected += new Amyuni.PDFCreator.IacThumbnailView.PageSelectedEventHandler(this.thumbnailView_PageSelected);
            // 
            // tabLeftPane
            // 
            this.tabLeftPane.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.tabLeftPane.Location = new System.Drawing.Point(0, 0);
            this.tabLeftPane.Name = "tabLeftPane";
            this.tabLeftPane.SelectedIndex = 0;
            this.tabLeftPane.Size = new System.Drawing.Size(259, 477);
            this.tabLeftPane.TabIndex = 0;
            this.tabLeftPane.SelectedIndexChanged += new System.EventHandler(this.tabLeftPane_SelectedIndexChanged);
            // 
            // pdfCreator
            // 
            this.pdfCreator.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.pdfCreator.BackColor = System.Drawing.SystemColors.Control;
            this.pdfCreator.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pdfCreator.ForeColor = System.Drawing.SystemColors.ControlText;
            this.pdfCreator.Location = new System.Drawing.Point(307, 74);
            this.pdfCreator.MeasurementUnit = 0;
            this.pdfCreator.Name = "pdfCreator";
            this.pdfCreator.RulerBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
            this.pdfCreator.RulerSize = 24;
            this.pdfCreator.ShowMargins = false;
            this.pdfCreator.Size = new System.Drawing.Size(627, 477);
            this.pdfCreator.TabIndex = 0;
            this.pdfCreator.TooltipText = "";
            // 
            // AppForm
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
            this.ClientSize = new System.Drawing.Size(944, 617);
            this.Controls.Add(this.panelLeftPane);
            this.Controls.Add(this.pdfCreator);
            this.Controls.Add(this.toolBar3);
            this.Controls.Add(this.toolBar2);
            this.Controls.Add(this.toolBar1);
            this.Controls.Add(this.statusBar1);
            this.Menu = this.mainMenu1;
            this.Name = "AppForm";
            this.Text = "PDF Creator Sample";
            this.Load += new System.EventHandler(this.AppForm_Load);
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
            this.panelLeftPane.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new AppForm());
		}

		private void menuItemFileOpen_Click(object sender, System.EventArgs e)
		{   
			// first check if a document has been modified
			if (pdfCreator.Document.Modified)
			{
				DialogResult result = MessageBox.Show(this,"Do you want to save your changes ?", "Save document", MessageBoxButtons.YesNoCancel);
				if (result == DialogResult.Yes)
					this.menuItemSave_Click(this, null);
				else if (result == DialogResult.Cancel)
					return;
			}

			try
			{
				// Create a new OpenFileDialog and display it.
			    OpenFileDialog dialog = new OpenFileDialog
			    {
			        Filter = "pdf files (*.pdf)|*.pdf|All files (*.*)|*.*",
			        FilterIndex = 1,
			        RestoreDirectory = true
			    };

			    if (dialog.ShowDialog() == DialogResult.OK)
				{
					string password = @"";
		
					if (dialog.CheckFileExists)
					{
						
						if ( (Control.ModifierKeys & Keys.Shift) == Keys.Shift )
						{
							PasswordForm passForm = new PasswordForm();
							if ( passForm.ShowDialog() == DialogResult.OK )
							{
								password = passForm.Password;
							}
						}	
						pdfCreator.Enabled = true;
						EnableToolbars(true);

                        pdfCreator.Document.AttributeByName("UseSystemFonts").Value = 1;

						System.IO.Stream stream = dialog.OpenFile();
						pdfCreator.Document.OpenEx(stream, password);
						//pdfCreator.Document.Open(dialog.FileName , password);
                        //stream.Close();
                        //stream = null;						
                        m_cut  = false;
						m_copy = false;
						m_doc = true;
						m_filename = dialog.FileName;
						bookmarkView.Initialize( pdfCreator.Document );
						bookmarkView.ReadOnly = false;

						thumbnailView.PDF = pdfCreator;
						pdfCreator.GridCtrlInterface = m_gridForm.GridCtrl;
						
						tabLeftPane_SelectedIndexChanged(null, null);
						pdfCreator.Document.ReportState = Amyuni.PDFCreator.IacReportState.acReportStateDesign;
					}
				}
			}
			catch (System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void EnableToolbars(bool enable)
		{
			for (int i = 0; i < toolBar3.Buttons.Count; i++)
				toolBar3.Buttons[i].Enabled  = enable;

			for (int i = 0; i < toolBar2.Buttons.Count; i++)
				toolBar2.Buttons[i].Enabled  = enable;

			for (int i = 0; i < toolBar1.Buttons.Count; i++)
				toolBar1.Buttons[i].Enabled  = enable;
			
			this.toolBar3.Buttons[0].Enabled = true;  //initblank
			this.toolBar3.Buttons[1].Enabled = true;  //fileopen

			EnableMultipleSelectionButtons();

		}

		private void menuItemInitBlank_Click(object sender, System.EventArgs e)
		{   
			try
			{
				pdfCreator.Enabled = true;
				pdfCreator.Document.InitBlank();
				this.bookmarkView.Initialize( pdfCreator.Document );
				this.thumbnailView.Initialize( pdfCreator );
				EnableToolbars(true);
				m_cut  = false;
				m_copy = false;
				m_doc = true;
			}
			catch (System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemAddPage_Click(object sender, System.EventArgs e)
		{    
			try
			{

				pdfCreator.Document.AddPage(0);
			} 
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemSave_Click(object sender, System.EventArgs e)
		{   
			try 
			{
				if (m_filename == null)
				{
				    SaveFileDialog dialog = new SaveFileDialog
				    {
				        Filter = "pdf files (*.pdf)|*.pdf|All files (*.*)|*.*",
				        FilterIndex = 1,
				        RestoreDirectory = true
				    };


				    if(dialog.ShowDialog() == DialogResult.OK)
					{
                        using (System.IO.Stream stream = dialog.OpenFile())
						    pdfCreator.Document.Save(stream, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveDefault);
						m_filename = dialog.FileName;
					}			
				}
				else 
				{
					System.IO.FileStream stream = System.IO.File.OpenWrite(m_filename);
					pdfCreator.Document.Save(stream, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveDefault);
					stream.Close();
					stream = null;
				}
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(this, exception.Message);
			}
		}

		private void menuItemSaveAs_Click(object sender, System.EventArgs e)
		{   
			try
			{
			    SaveFileDialog dialog = new SaveFileDialog
			    {
			        Filter = "pdf files (*.pdf)|*.pdf|All files (*.*)|*.*",
			        FilterIndex = 1,
			        RestoreDirectory = true
			    };


			    if(dialog.ShowDialog() == DialogResult.OK)
				{
                    using (System.IO.Stream stream = dialog.OpenFile())
					    pdfCreator.Document.Save(stream, Amyuni.PDFCreator.IacFileSaveOption.acFileSaveDefault);
					m_filename = dialog.FileName;
				}	
			}
			catch (System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemSetAttributeByName_Click(object sender, EventArgs e)
		{
			SetAttributeForm form = new SetAttributeForm();
			if (form.ShowDialog() == DialogResult.OK)
			{
				string objectName = form.txtObjectName.Text;
				string attributeName = form.txtAttributeName.Text;
				string attributeValue = form.txtAttributeValue.Text;

				try
				{

					Amyuni.PDFCreator.IacAttribute attribute = pdfCreator.Document.ObjectByName (objectName).AttributeByName (attributeName);
					switch (attribute.Type)
					{
						case IacAttributeType.Color:
							attribute.Value = attributeValue;
							break;

						case IacAttributeType.Boolean:
						case IacAttributeType.Enum:
						case IacAttributeType.Int32:
						case IacAttributeType.Int16:
							
							attribute.Value = Convert.ToInt32(attributeValue);
							break;

						case IacAttributeType.Single:

							attribute.Value = Convert.ToSingle(attributeValue);
							break;

					    case IacAttributeType.String:
					        break;
					    case IacAttributeType.Format:
					        break;
					    case IacAttributeType.Font:
					        break;
					    case IacAttributeType.File:
					        break;
					    case IacAttributeType.Object:
					        break;
					    case IacAttributeType.Data:
					        break;
					    case IacAttributeType.CLSID:
					        break;
					    case IacAttributeType.Field:
					        break;
					    case IacAttributeType.Points:
					        break;
					    case IacAttributeType.Array:
					        break;
					    case IacAttributeType.ObjArray:
					        break;
					    case IacAttributeType.FString:
					        break;
					    case IacAttributeType.ACString:
					        break;
					    case IacAttributeType.EnumSingle:
					        break;
					    default:
							attribute.Value = attributeValue.ToString();
							break;
					}
				}
				catch (System.Exception)
				{
					MessageBox.Show("Object or Attribute not found");
				}
			}

		}

		private void menuItemPrint_Click(object sender, System.EventArgs e)
		{    
			pdfCreator.Document.Print("", true);
		}

		private void menuItemExit_Click(object sender, System.EventArgs e)
		{   
			try
			{

				if (pdfCreator.Document.Modified)
				{
					DialogResult result = MessageBox.Show(this,"Do you want to save your changes ?", "Save document", MessageBoxButtons.YesNoCancel);
					if (result == DialogResult.Cancel)
						return;
					else if (result == DialogResult.Yes)
						this.menuItemSave_Click(this, null);
				}
			}
			catch (System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}

			Application.Exit();
		}

		public int pdfControl_FireBeforeDelete(System.Object obj, System.EventArgs args)
		{
			return 1;
		}

		public void pdfControl_FireRefresh(object sender, System.EventArgs args)
		{
			EnableMultipleSelectionButtons();
			// do not call the PDFCreator refresh here
		}

		public int pdfControl_FireClickHyperlink(System.Object obj, Amyuni.PDFCreator.IacEventArgs args)
		{
			return 1;
		}

		public int pdfControl_FirePrintPage(System.Object obj, Amyuni.PDFCreator.IacEventArgs args)
		{
			int nRet = 0;

			string message = $"Print page number {args.value.ToString()} ?";
			string caption = "Print";
			MessageBoxButtons buttons = MessageBoxButtons.YesNo;

		    var result = MessageBox.Show(this, message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

			if(result == DialogResult.Yes)
			{
				nRet = 1;
			}

			return nRet;
		}

		private int pdfControl_FireActivateObject(object sender, IacEventArgs e)
		{
			return 1;
		}

		private int pdfControl_FireContextSensitiveMenu(object sender, EventArgs e)
		{
			return 1;
		}

		private int pdfControl_FireLoadPage(object sender, IacEventArgs e)
		{
			return 1;
		}

		private int pdfControl_FireMouseDown(object sender, IacEventArgs e)
		{
			return 1;
		}

        private int pdfControl_FireMouseRightButtonDown(object sender, IacEventArgs e)
		{
			return 1;
		}
		private int pdfControl_FireMouseMove(object sender, IacEventArgs e)
		{
			return 1;
		}

		private int pdfControl_FireMouseUp(object sender, IacEventArgs e)
		{
			return 1;
		}

		private int pdfControl_FireNewObject(object sender, IacEventArgs e)
		{
			return 1;

//			String str = string.Format("New object event received. Do you accept new object {0} ?", e.acObject.Name);
//			if (MessageBox.Show(str, "New Object event",	MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
//				return 1;
//			else
//				return 0;
		}

		private int pdfControl_FireEvaluateExpression(object sender, IacEventArgsEvaluateExpression e)
		{
            //if returning 0, then set the e.result to whatever you would like the result of the expression to be. By default, it has the same value as e.expression
			return 1;
		}

		private int pdfControl_FireProcessingProgress(object sender, IacEventArgsProcessingProgress e)
		{
			return 1;
		}

		private void pdfControl_FireObjectTextChange(object sender, IacEventArgs e)
		{
		}

		private int pdfControl_FireSavePage(object sender, IacEventArgs e)
		{
			return 1;
		}

		private void EnableMultipleSelectionButtons()
		{
			try
			{

				if (pdfCreator.Document.GetSelectedObjectCount() >= 1)
				{
					toolBar2.Buttons[12].Enabled = true;
					toolBar2.Buttons[13].Enabled = true;
				}
				else
				{
					toolBar2.Buttons[12].Enabled = false;
					toolBar2.Buttons[13].Enabled = false;
				}
				
				if (pdfCreator.Document.GetSelectedObjectCount() > 1)
				{
					toolBar2.Buttons[15].Enabled = true;
					toolBar2.Buttons[16].Enabled = true;	
					toolBar2.Buttons[17].Enabled = true;	
					toolBar2.Buttons[18].Enabled = true;
					toolBar2.Buttons[19].Enabled = true;
					toolBar2.Buttons[20].Enabled = true;
					toolBar2.Buttons[22].Enabled = true;
					toolBar2.Buttons[23].Enabled = true;
				}
				else
				{
					toolBar2.Buttons[15].Enabled = false;
					toolBar2.Buttons[16].Enabled = false;	
					toolBar2.Buttons[17].Enabled = false;	
					toolBar2.Buttons[18].Enabled = false;
					toolBar2.Buttons[19].Enabled = false;
					toolBar2.Buttons[20].Enabled = false;
					toolBar2.Buttons[22].Enabled = false;
					toolBar2.Buttons[23].Enabled = false;
				}
			} 
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void pdfControl_FireSelectedObjectChange2(object sender, EventArgs e)
		{
			EnableMultipleSelectionButtons();
		}

		private void menuItemStartSave_Click(object sender, EventArgs e)
		{
			try
			{
				IacDocument document  = pdfCreator.Document;
			    SaveFileDialog dialog = new SaveFileDialog
			    {
			        Filter = "pdf files (*.pdf)|*.pdf|All files (*.*)|*.*",
			        FilterIndex = 1,
			        RestoreDirectory = true
			    };


			    if(dialog.ShowDialog() == DialogResult.OK)
				{			
					pdfCreator.Document.StartSave(dialog.OpenFile());
				}
			}
			catch (System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}			
		}

		private void menuItemEndSave_Click(object sender, EventArgs e)
		{
			pdfCreator.Document.EndSave();
		}

		private void menuItemSavePage_Click(object sender, EventArgs e)
		{
			try
			{
				PageNumberForm dialog = new PageNumberForm();
				dialog.ShowDialog();

				int pageNumber = Convert.ToInt32(dialog.txtPageNumber.Text);
				pdfCreator.Document.SavePageNumber(pageNumber);
			}
			catch (System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemUndo_Click(object sender, EventArgs e)
		{
			try
			{
				IacDocument document  = pdfCreator.Document;
				pdfCreator.Document.Undo();
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemRedo_Click(object sender, EventArgs e)
		{
			try
			{
				IacDocument document  = pdfCreator.Document;
				pdfCreator.Document.Redo();
			} 
			catch (System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemDeletePage_Click(object sender, EventArgs e)
		{
			PageNumberForm dialog = new PageNumberForm();
			
			if (dialog.ShowDialog() == DialogResult.OK)
			{
				try
				{
					int pageNumber = Convert.ToInt32(dialog.txtPageNumber.Text);
					pdfCreator.Document.GetPage(pageNumber-1).Delete(true);
				}
				catch (System.Exception)
				{
					MessageBox.Show("Page not found");
				}
			}
		}

		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			try
			{
				switch (toolBar1.Buttons.IndexOf(e.Button))
				{
					case 0:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolSelect);
						break;
					case 1:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolLabel);
						break;
					case 2:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolLine);
						break;				
					case 3:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolFrame);
						break;
					case 4:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolRoundFrame);
						break;
					case 5:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolEllipse);
						break;
					case 6:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolEllipse);
						break;
					case 7:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolPolygon);
						break;				
					case 8:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolPicture);
						break;
					case 10:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolStickyNote);
						break;
					case 11:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolHighlight);
						break;
					case 12:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolArrow);
						break;				
					case 14:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolField);
						break;
					case 15:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolCheckBox);
						break;
					case 16:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolSelection);
						break;
					case 18:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolTable);
						break;
					case 19:
						MessageBox.Show("Not implemented");
						//pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolExcel);
						break;
					case 20:
						MessageBox.Show("Not implemented");
						//pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolWord);
						break;
					case 21:
						MessageBox.Show("Not implemented");
						//pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolWord);
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolGraph);
						break;
					case 22:
						MessageBox.Show("Not implemented");
						//pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolWord);
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolOLE);
						break;
				}
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}


		private void toolBar2_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			try
			{
				switch (toolBar2.Buttons.IndexOf(e.Button))
				{
					case 0:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolFont);
						break;
					case 1:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolBold);
						break;
					case 2:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolItalic);
						break;				
					case 3:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolUnderline);
						break;
					case 5:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAlignLeft);
						toolBar2.Buttons[6].Pushed = false;
						toolBar2.Buttons[7].Pushed = false;
						toolBar2.Buttons[8].Pushed = false;
						break;
					case 6:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAlignCenter);
						toolBar2.Buttons[5].Pushed = false;
						toolBar2.Buttons[7].Pushed = false;
						toolBar2.Buttons[8].Pushed = false;
						break;
					case 7:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAlignRight);
						toolBar2.Buttons[5].Pushed = false;
						toolBar2.Buttons[6].Pushed = false;
						toolBar2.Buttons[8].Pushed = false;
						break;
					case 8:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAlignJustify);
						toolBar2.Buttons[5].Pushed = false;
						toolBar2.Buttons[6].Pushed = false;
						toolBar2.Buttons[7].Pushed = false;
						break;				
					case 10:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolProperties);
						break;
					case 12:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolBringForward);
						break;
					case 13:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolBringBackward);
						break;
					case 15:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAlignLeftEdges);
						break;				
					case 16:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAlignRightEdges);
						break;
					case 17:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAlignTopEdges);
						break;
					case 18:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAlignBottomEdges);
						break;
					case 19:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAlignHorizontalCenters);
						break;
					case 20:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAlignVerticalCenters);
						break;
					case 22:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolMakeSameWidths);
						break;
					case 23:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolMakeSameHeights);
						break;
					case 25:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolGridSpacing);
						break;
				}
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void toolBar3_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			try
			{
				switch (toolBar3.Buttons.IndexOf(e.Button))
				{
					case 0:
						this.menuItemInitBlank_Click(this, null);
						break;
					case 1:
						this.menuItemFileOpen_Click(this, null);
						break;
					case 2:
						menuItemSave_Click(this, null);
						break;				
					case 4:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolPrint);
						break;
					case 6:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolCut);
						break;
					case 7:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolCopy);
						break;				
					case 8:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolPaste);
						break;
					case 10:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolUndo);
						break;
					case 11:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolRedo);
						break;
					case 13:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolPageView);
						toolBar3.Buttons[14].Pushed = false;
						break;
					case 14:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolNormalView);
						toolBar3.Buttons[13].Pushed = false;
						break;				
					case 15:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolViewGrids);
						break;
					case 17:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolZoomOut);
						break;
					case 18:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolZoomIn);
						break;
					case 20:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolRotateLeft);
						break;
					case 21:
						pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolRotateRight);
						break;
					case 22:

						pdfCreator.DoCommandTool( Amyuni.PDFCreator.IacCommandTool.acCommandToolDesignMode );
						pdfCreator.PropertiesCtrlInterface = m_propertiesForm.PropertiesCtrlInterface;
						break;
					case 23:
						m_docSettingsForm.PDF = pdfCreator;
						m_docSettingsForm.ShowDialog( this );
						break;
                    case 24:
                        pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolPanningMode);
                        break;
                    case 25:
                        pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolRunDocument);
                        break;
				}
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void pdfControl_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
		{
		
		}

		private void menuItemActivate_Click(object sender, System.EventArgs e)
		{
			ObjectForm form = new ObjectForm(true);
		
			if (form.ShowDialog() == DialogResult.OK)
			{
				try
				{
					string objectName = form.txtName.Text;
					pdfCreator.Document.ObjectByName(objectName).Activate();
				}
				catch (System.Exception)
				{
					MessageBox.Show("Object not found");
				}
			}			
		}

		private void menuItemSelectAll_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.Document.SelectAllObjects(true);
			} 
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemRotate_Click(object sender, System.EventArgs e)
		{
		}

		private void menuItemMinus90_Click(object sender, System.EventArgs e)
		{
			try
			{
				IacDocument document = pdfCreator.Document;
				document.RotatePage(document.CurrentPage.PageNumber, Amyuni.PDFCreator.IacRotatePageOption.acRotatePageLeft);
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
			
		}

		private void menuItemPlus90_Click(object sender, System.EventArgs e)
		{
			try
			{
				IacDocument document = pdfCreator.Document;
				document.RotatePage(document.CurrentPage.PageNumber, Amyuni.PDFCreator.IacRotatePageOption.acRotatePageRight);
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItem180_Click(object sender, System.EventArgs e)
		{
			try
			{
				IacDocument document = pdfCreator.Document;
				document.RotatePage(document.CurrentPage.PageNumber, Amyuni.PDFCreator.IacRotatePageOption.acRotatePageFull);
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemRedraw_Click(object sender, System.EventArgs e)
		{
			ObjectForm form = new ObjectForm(true);
		
			if (form.ShowDialog() == DialogResult.OK)
			{
				try
				{
					string objectName = form.txtName.Text;
					pdfCreator.Document.ObjectByName(objectName).Redraw();
				}
				catch (System.Exception)
				{
					MessageBox.Show("Object not found");
				}
			}			
		
		}

		private void menuItemGetObjectByName_Click(object sender, System.EventArgs e)
		{
			ObjectForm form = new ObjectForm(true);
			if (form.ShowDialog() == DialogResult.OK)
			{
				try
				{
					string objectName = form.txtName.Text;
					Amyuni.PDFCreator.IacObject acObject = pdfCreator.Document.ObjectByName(objectName);

					if (acObject != null)
					{ 
						AttributesForm attribForm = new AttributesForm(acObject);
						attribForm.ShowDialog();
					}
					else
					{
						MessageBox.Show("Object not found");
					}
				}
				catch (System.Exception)
				{
					MessageBox.Show("Object/Attribute not set");
				}
			}		
		}

		private void menuItemGetAttributeByName_Click(object sender, System.EventArgs e)
		{
			AttributeForm form = new AttributeForm();

			if (form.ShowDialog() == DialogResult.OK)
			{
				try
				{
					string objectName = form.txtObjectName.Text;
					string attributeName = form.txtAttributeName.Text;

					object obj = pdfCreator.Document.ObjectByName(objectName).AttributeByName(attributeName).Value;
					string str = String.Format("{0} = {1}", attributeName, obj.ToString());
					MessageBox.Show(str);
				}
				catch (System.Exception)
				{
					MessageBox.Show("Object or attribute not set");
				}
			}
		}


		private void menuItemNewPage_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.Document.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolInsertPage);		
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemMovePage_Click(object sender, System.EventArgs e)
		{
			try
			{
				IacDocument document  = pdfCreator.Document;
				PagesForm dialog = new PagesForm();
				dialog.ShowDialog();

				if (dialog.DialogResult == DialogResult.OK)
				{
					document.MovePages(Convert.ToInt32(dialog.txtFromPage.Text), Convert.ToInt32(dialog.txtNumPages.Text), Convert.ToInt32(dialog.txtToPage.Text));
				}
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		
		}

		private void menuItemAppendPage_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.Document.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolAppendPage);
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemDuplicatePage_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.Document.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolDuplicatePage);
			}
			catch (System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemStartPrint_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.Document.StartPrint("", true);
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemPrintPage_Click(object sender, System.EventArgs e)
		{
			try
			{
				IacDocument document = pdfCreator.Document;
				document.PrintPage(document.CurrentPage);
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemEndPrint_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.Document.EndPrint();
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemPaste_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolPaste);
			}
			catch(System.Exception exception)
			{ 				
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemCut_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolCut);
				m_cut = true;
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemCopy_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolCopy);
				m_copy = true;
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void pdfCreator_FireSelectedObjectChange(object sender, EventArgs e)
		{
		}

		private void menuItemFind_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolSearch);
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemReplace_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.DoCommandTool(Amyuni.PDFCreator.IacCommandTool.acCommandToolReplace);		
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemAbout_Click(object sender, System.EventArgs e)
		{
			string text = string.Format("PDF Creator Sample Application \n\nControl Product Name: {0} \n\nControl Version: {1} \n\n{2}", pdfCreator.ProductName, pdfCreator.ProductVersion, pdfCreator.Copyright); 
			MessageBox.Show(this, text, "About PDF Creator Sample");		
		}

		private void menuItemExportAs_Click(object sender, System.EventArgs e)
		{
			try
			{
				SaveFileDialog dialog = new SaveFileDialog();
 
				dialog.Filter = "HTML files (*.HTML)|*.HTML|RTF/TXT files (*.RTF/*.TXT)|*.TXT|JPEG files (*.JPG)|*.JPG|Excel files (*.XLS)|*.XLS|All files (*.*)|*.*"  ;
				dialog.FilterIndex = 1;
				dialog.RestoreDirectory = true ;
 
				if(dialog.ShowDialog() == DialogResult.OK)
				{
					string name = dialog.FileName.ToUpper();

					if (name.EndsWith(".HTML"))
						pdfCreator.Document.ExportToHTML(name, Amyuni.PDFCreator.IacHtmlExportOption.acHtmlExportOptionSinglePage);
					else if ( name.EndsWith (".RTF") || name.EndsWith (".TXT") )
						pdfCreator.Document.ExportToRTF(name, Amyuni.PDFCreator.IacRtfExportOption.acRtfExportOptionRTFText, true) ;
					else if (name.EndsWith (".XLS"))
						pdfCreator.Document.ExportToExcel(name, Amyuni.PDFCreator.IacExcelExportOption.acExcelExportOptionMultipleSheets);				
				}	
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemDeleteObject_Click(object sender, System.EventArgs e)
		{
			ObjectForm form = new ObjectForm(true);
		
			if (form.ShowDialog() == DialogResult.OK)
			{
				try
				{
					string objectName = form.txtName.Text;
					pdfCreator.Document.ObjectByName(objectName).Delete(true);
				}
				catch (System.Exception)
				{
					MessageBox.Show("Object not found");
				}
			}			
		
		}

		private void menuItemScrollIntoView_Click(object sender, System.EventArgs e)
		{
			ObjectForm form = new ObjectForm(true);
		
			if (form.ShowDialog() == DialogResult.OK)
			{
				try
				{
					string objectName = form.txtName.Text;
					pdfCreator.Document.ObjectByName(objectName).ScrollIntoView();
                    /*
                    IacObject obj = pdfCreator.Document.ObjectByName(objectName);
                    Rectangle rc = obj.GetScreenCoordinates();
                    MessageBox.Show( rc.ToString() );
                    */

				}
				catch (System.Exception )
				{
					MessageBox.Show("Object not found");
				}
			}			
		}

		private void menuItemFile_Popup(object sender, EventArgs e)
		{
			try
			{

				if (pdfCreator.Document.Modified)
				{
					this.menuItemSave.Enabled = true;
					this.menuItemSavePage.Enabled = true;
					this.menuItemStartSave.Enabled = true;
					this.menuItemEndSave.Enabled = true;
				} 
				else
				{
					this.menuItemSave.Enabled = false;
					this.menuItemSavePage.Enabled = false;
					this.menuItemStartSave.Enabled = false;
					this.menuItemEndSave.Enabled = false;
				}
				if (m_doc && pdfCreator.Document.PageCount > 0)
				{
					this.menuItemSave.Enabled = true;
					this.menuItemExportAs.Enabled = true;
					this.menuItemPrint.Enabled = true;
					this.menuItemStartPrint.Enabled = true;
					this.menuItemEndPrint.Enabled = true;
					this.menuItemPrintPage.Enabled = true;
				} 
				else
				{	this.menuItemSave.Enabled = false;
					this.menuItemExportAs.Enabled = false;
					this.menuItemPrint.Enabled = false;
					this.menuItemStartPrint.Enabled = false;
					this.menuItemEndPrint.Enabled = false;
					this.menuItemPrintPage.Enabled = false;
				}

			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemEdit_Popup(object sender, EventArgs e)
		{
			try
			{

				this.menuItemRedo.Enabled = (pdfCreator.Document.RedoLevels() > 0);
				this.menuItemUndo.Enabled = (pdfCreator.Document.UndoLevels() > 0);

				if (pdfCreator.Document.GetSelectedObjectCount() > 0)
				{
					this.menuItemCut.Enabled = true;
					this.menuItemCopy.Enabled = true;
				}
				else
				{
					this.menuItemCut.Enabled = false;
					this.menuItemCopy.Enabled = false;
				}

				if (m_cut || m_copy)
				{
					this.menuItemPaste.Enabled = true;
				}
				else 
				{
					this.menuItemPaste.Enabled = false;
				}

			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemPage_Popup(object sender, EventArgs e)
		{
			try
			{
				if (m_doc)
				{
					this.menuItemNewPage.Enabled = true;
				}
				else
				{
					this.menuItemNewPage.Enabled = false;
				}

				if (m_doc && pdfCreator.Document.PageCount > 0)
				{
					this.menuItemAppendPage.Enabled = true;
					this.menuItemDuplicatePage.Enabled = true;
					this.menuItemRotate.Enabled = true;
					this.menuItemMovePage.Enabled = true;
					this.menuItemDeletePage.Enabled = true;
					this.menuItemObjectCount.Enabled = true;
					this.menuItemClear.Enabled = true;
					this.menuItemCreateObject.Enabled = true;
					this.menuItemPageFormat.Enabled = true;
					
				} 
				else
				{
					this.menuItemAppendPage.Enabled = false;
					this.menuItemDuplicatePage.Enabled = false;
					this.menuItemRotate.Enabled = false;
					this.menuItemMovePage.Enabled = false;
					this.menuItemDeletePage.Enabled = false;
					this.menuItemObjectCount.Enabled = false;
					this.menuItemClear.Enabled = false;
					this.menuItemCreateObject.Enabled = false;
					this.menuItemPageFormat.Enabled = false;
					
				}
			}
			catch (System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemObject_Popup(object sender, EventArgs e)
		{
			try
			{
				if (m_doc)
				{
					this.menuItemGetObjectByName.Enabled = true;
					this.menuItemObjectByXY.Enabled = true;
					this.menuItemGetAttributeByName.Enabled = true;
					this.menuItemSetAttributeByName.Enabled = true;
					this.menuItemActivate.Enabled = true;
					this.menuItemRedraw.Enabled = true;
					this.menuItemScrollIntoView.Enabled = true;
					this.menuItemDeleteObject.Enabled = true;
				}
				else
				{
					this.menuItemGetObjectByName.Enabled = false;
					this.menuItemObjectByXY.Enabled = false;
					this.menuItemGetAttributeByName.Enabled = false;
					this.menuItemSetAttributeByName.Enabled = false;
					this.menuItemActivate.Enabled = false;
					this.menuItemRedraw.Enabled = false;
					this.menuItemScrollIntoView.Enabled = false;
					this.menuItemDeleteObject.Enabled = false;
				}

			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemClear_Click(object sender, System.EventArgs e)
		{
			try
			{
				pdfCreator.Document.CurrentPage.Clear();
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}

		}

		private void menuItemObjectCount_Click(object sender, System.EventArgs e)
		{
			try
			{
				int numObjects = pdfCreator.Document.CurrentPage.ObjectCount();
				string str = String.Format ("Number of objects on current page = {0}", numObjects.ToString());
				MessageBox.Show(this, str);
	
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}

		}

		private void menuItemCreateObject_Click(object sender, System.EventArgs e)
		{
			try
			{
				ObjectForm dialog = new ObjectForm(false);
				if (dialog.ShowDialog() == DialogResult.OK)
				{
					pdfCreator.Document.CurrentPage.CreateObject(Amyuni.PDFCreator.IacObjectType.acObjectTypeText, dialog.txtName.Text);
					Amyuni.PDFCreator.IacAttribute attr = pdfCreator.Document.CurrentPage.ObjectByName(dialog.txtName.Text).AttributeByName("Text");
					attr.Value = dialog.txtValue.Text;
				}
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		}

		private void menuItemPageFormat_Click(object sender, System.EventArgs e)
		{
			try
			{
				PageFormatForm form = new PageFormatForm(pdfCreator.Document.CurrentPage.GetPageFormat());
				form.ShowDialog();
			}
			catch(System.Exception exception)
			{
				MessageBox.Show(exception.Message);
			}
		
		}

		private void menuItemObjectByXY_Click(object sender, System.EventArgs e)
		{
			ObjectXYForm form = new ObjectXYForm();
			if (form.ShowDialog() == DialogResult.OK)
			{
				try
				{
					int x = Convert.ToInt32(form.txtX.Text);
					int y = Convert.ToInt32(form.txtY.Text);
					Amyuni.PDFCreator.IacObject acObject = pdfCreator.Document.CurrentPage.ObjectByXY(x, y);

					if (acObject != null)
					{ 
						AttributesForm attribForm = new AttributesForm(acObject);
						attribForm.ShowDialog();
					}
					else
					{
						MessageBox.Show("Object not found");
					}
				}
				catch (System.Exception )
				{
					MessageBox.Show("Object/Attribute not set");
				}
			}				
		}

		private void AppForm_Load(object sender, System.EventArgs e)
		{
			m_propertiesForm = new PropertiesForm();
			this.AddOwnedForm( m_propertiesForm );

			m_docSettingsForm = new DocSettingsForm();
			this.AddOwnedForm( m_docSettingsForm );

			m_gridForm = new GridForm();
			this.AddOwnedForm( m_gridForm );
            
			m_propertiesForm.PropertiesCtrl.PDFCreatorCtrl = this.pdfCreator;
            
            this.pdfCreator.MeasurementUnit = 0;

			pdfCreator.DoCommandTool( Amyuni.PDFCreator.IacCommandTool.acCommandToolDesignMode );
			tabLeftPane.TabPages.Add( new TabPage("Bookmarks") );
			tabLeftPane.TabPages.Add( new TabPage("Thumbnails") );

			thumbnailView.Left = bookmarkView.Left = 2;
			thumbnailView.Width = bookmarkView.Width = panelLeftPane.Width - 4;
			thumbnailView.Top = bookmarkView.Top = tabLeftPane.ItemSize.Height + 2;
			thumbnailView.Height = bookmarkView.Height = panelLeftPane.Height - bookmarkView.Top - 2;

			thumbnailView.ThumbSizeFactor = 14;
		}
		private void tabLeftPane_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			switch ( tabLeftPane.SelectedTab.Text )
			{
				case "Bookmarks":
				{
					bookmarkView.BringToFront();
					break;
				}
				case "Thumbnails":
				{
					thumbnailView.BringToFront();
					break;
				}
			}
		}
		private void thumbnailView_PageActivated(object sender, Amyuni.PDFCreator.IacThumbnailView.acThumbnailViewEvenArgs e)
		{
			//e.Cancel = true;
			//return;
			Amyuni.PDFCreator.IacPage page = pdfCreator.Document.GetPage( e.Page );
			pdfCreator.Document.CurrentPage = page;
		}
		private void thumbnailView_DeleteSelectedPages(object sender, Amyuni.PDFCreator.IacThumbnailView.acThumbnailViewEvenArgs e)
		{
			if ( DialogResult.No == MessageBox.Show( "Are you sure you want to delete the selected page(s) ?", "Confirm page deletion...", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly ) )
				e.Cancel = true;
			return;
		}
		private void thumbnailView_PageSelected(object sender, Amyuni.PDFCreator.IacThumbnailView.acThumbnailViewEvenArgs e)
		{
		}
	}
}
