private void InitializeHelperObjects() { // DocManager DocManagerData data = new DocManagerData(); data.FormOwner = this; data.UpdateTitle = true; data.FileDialogFilter = "MaBongPal files (*.mbp)|*.mbp|All Files (*.*)|*.*"; data.NewDocName = "Untitled.mbp"; data.RegistryPath = registryPath; docManager = new DocManager(data); docManager.RegisterFileType("mbp", "mbpfile", "MaBongPal File"); docManager.SaveEvent += new SaveEventHandler(docManager_SaveEvent); docManager.LoadEvent += new LoadEventHandler(docManager_LoadEvent); docManager.OpenEvent += new OpenFileEventHandler(docManager_OpenEvent); docManager.DocChangedEvent += new EventHandler(docManager_DocChangedEvent); docManager.ClearEvent += new EventHandler(docManager_ClearEvent); docManager.NewDocument(); // DragDropManager dragDropManager = new DragDropManager(this); dragDropManager.FileDroppedEvent += new FileDroppedEventHandler(this.dragDropManager_FileDroppedEvent); // MruManager mruManager = new MruManager(); mruManager.Initialize(this, menuFileRecentFiles, registryPath); mruManager.MruOpenEvent += new MruFileOpenEventHandler(mruManager_MruOpenEvent); // ODSExporter odsExporter = new ODSExporter(); }
private void InitializeHelperObjects() { int x = drawArea.TheLayers.ActiveLayerIndex; // DocManager DocManagerData data = new DocManagerData(); //HAMID //data.FormOwner = tempOwner; data.UpdateTitle = true; data.FileDialogFilter = "Genetibase.NuGenAnnotation files (*.dtl)|*.dtl|All Files (*.*)|*.*"; data.NewDocName = "Untitled.dtl"; //data.RegistryPath = registryPath; docManager = new DocManager(data); docManager.RegisterFileType("dtl", "dtlfile", "Genetibase.NuGenAnnotation File"); // Subscribe to DocManager events. //docManager.SaveEvent += docManager_SaveEvent; //docManager.LoadEvent += docManager_LoadEvent; docManager.DocChangedEvent += delegate(object o, EventArgs e) { drawArea.Refresh(); drawArea.ClearHistory(); }; docManager.ClearEvent += delegate(object o, EventArgs e) { bool haveObjects = false; for (int i = 0; i < drawArea.TheLayers.Count; i++) { if (drawArea.TheLayers[i].Graphics.Count > 1) { haveObjects = true; break; } } if (haveObjects) { drawArea.TheLayers.Clear(); drawArea.ClearHistory(); drawArea.Refresh(); } }; docManager.NewDocument(); }
public MainForm() { InitializeComponent(); g = this.CreateGraphics(); DocManagerData data = new DocManagerData(); data.FormOwner = this; data.UpdateTitle = true; data.FileDialogFilter = "DrawTools files (*.dtl)|*.dtl|All Files (*.*)|*.*"; data.NewDocName = "Untitled.dtl"; docManager = new DocManager(data); docManager.RegisterFileType("dtl", "dtlfile", "DrawTools File"); this.Cursor = Cursors.Cross; drawArea.Location = new System.Drawing.Point(0, 0); drawArea.Size = new System.Drawing.Size(200, 200); drawArea.Owner = this; drawArea.Visible = false; drawArea.Initialize(this, docManager); GraphicsProperties graphicProperties = drawArea.GraphicsList.GetProperties(); this.myColorPicker.SelectedColor = DrawSettings.LastUsedColor; this.myColorPicker.PenWidth = graphicProperties.PenWidth; this.drawArea.ToolTextBox.ForeColor = DrawSettings.LastUsedColor; this.myColorPicker.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { GraphicsProperties p = new GraphicsProperties(); p.Color = e.Color; p.PenWidth = e.Width; this.drawArea.ToolTextBox.ForeColor = e.Color.Value; this.drawArea.ToolTextBox.Font = new System.Drawing.Font("Arial Narrow", e.TextSize); if (drawArea.GraphicsList.ShowColorPickerPanel(drawArea, p)) { drawArea.SetDirty(); drawArea.Refresh(); } }; }
/// <summary> /// Initialize helper objects from the DocToolkit Library. /// /// Called from Form1_Load. Initialized all objects except /// PersistWindowState wich must be initialized in the /// form constructor. /// </summary> private void InitializeHelperObjects() { // DocManager DocManagerData data = new DocManagerData(); data.FormOwner = this; data.UpdateTitle = true; data.FileDialogFilter = "DrawTools files (*.dtl)|*.dtl|All Files (*.*)|*.*"; data.NewDocName = "Untitled.dtl"; data.RegistryPath = registryPath; docManager = new DocManager(data); docManager.RegisterFileType("dtl", "dtlfile", "DrawTools File"); docManager.SaveEvent += new SaveEventHandler(docManager_SaveEvent); docManager.LoadEvent += new LoadEventHandler(docManager_LoadEvent); docManager.OpenEvent += new OpenFileEventHandler(docManager_OpenEvent); docManager.DocChangedEvent += new EventHandler(docManager_DocChangedEvent); docManager.ClearEvent += new EventHandler(docManager_ClearEvent); docManager.NewDocument(); // DragDropManager dragDropManager = new DragDropManager(this); dragDropManager.FileDroppedEvent += new FileDroppedEventHandler(this.dragDropManager_FileDroppedEvent); // MruManager mruManager = new MruManager(); mruManager.Initialize( this, // owner form menuFileRecentFiles, // Recent Files menu item registryPath); // Registry path to keep MRU list mruManager.MruOpenEvent += new MruFileOpenEventHandler(mruManager_MruOpenEvent); }
/// <summary> /// Initialize helper objects from the DocToolkit Library. /// /// Called from Form1_Load. Initialized all objects except /// PersistWindowState wich must be initialized in the /// form constructor. /// </summary> private void InitializeHelperObjects() { // DocManager DocManagerData data = new DocManagerData(); data.FormOwner = this; data.UpdateTitle = true; data.FileDialogFilter = "DrawTools files (*.dtl)|*.dtl|All Files (*.*)|*.*"; data.NewDocName = "Untitled.dtl"; data.RegistryPath = registryPath; docManager = new DocManager(data); docManager.RegisterFileType("dtl", "dtlfile", "DrawTools File"); // Subscribe to DocManager events. docManager.SaveEvent += docManager_SaveEvent; docManager.LoadEvent += docManager_LoadEvent; // Make "inline subscription" using anonymous methods. docManager.OpenEvent += delegate(object sender, OpenFileEventArgs e) { // Update MRU List if (e.Succeeded) { mruManager.Add(e.FileName); } else { mruManager.Remove(e.FileName); } }; docManager.DocChangedEvent += delegate(object o, EventArgs e) { drawArea.Refresh(); drawArea.ClearHistory(); }; docManager.ClearEvent += delegate(object o, EventArgs e) { if (drawArea.GraphicsList != null) { drawArea.GraphicsList.Clear(); drawArea.ClearHistory(); drawArea.Refresh(); } }; docManager.NewDocument(); // DragDropManager dragDropManager = new DragDropManager(this); dragDropManager.FileDroppedEvent += delegate(object sender, FileDroppedEventArgs e) { OpenDocument(e.FileArray.GetValue(0).ToString()); }; // MruManager mruManager = new MruManager(); mruManager.Initialize( this, // owner form recentFilesToolStripMenuItem, // Recent Files menu item fileToolStripMenuItem, // parent registryPath); // Registry path to keep MRU list mruManager.MruOpenEvent += delegate(object sender, MruFileOpenEventArgs e) { OpenDocument(e.FileName); }; }