コード例 #1
0
        /// <summary>
        /// Opens an existing document from a file.
        /// </summary>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">The event arguments.</param>
        private void OpenDocument(object sender, EventArgs e)
        {
            if (this.openDocumentDialog.ShowDialog() == DialogResult.OK)
            {
                EditorWindow editor = new EditorWindow(this.openDocumentDialog.FileName);
                editor.MdiParent = this;
                editor.FormClosed += new FormClosedEventHandler(this.OnDocumentClosed);
                editor.UpdateReceived += new EventHandler(this.OnDocumentUpdateReceived);

                this.editorWindows.Add(editor);
                editor.Show();
            }
        }
コード例 #2
0
        /// <summary>
        /// Creates a new blank document.
        /// </summary>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">The event arguments.</param>
        private void NewDocument(object sender, EventArgs e)
        {
            EditorWindow editor = new EditorWindow();
            editor.MdiParent = this;
            editor.FormClosed += new FormClosedEventHandler(this.OnDocumentClosed);
            editor.UpdateReceived += new EventHandler(this.OnDocumentUpdateReceived);

            string windowTitle = String.Format(CultureInfo.InvariantCulture, "Document {0}", this.editorWindows.Count + 1);
            editor.Text = windowTitle;

            this.editorWindows.Add(editor);
            editor.Show();
        }