Esempio n. 1
0
        private void openModelesslyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.prefDialog = new PreferencesDialog();

            // Update the properties for the dialog before it's shown


            this.prefDialog.BackColor        = TextBox.BackColor;
            this.prefDialog.TextColor        = TextBox.ForeColor;
            this.prefDialog.Font             = TextBox.Font;
            this.prefDialog.DocumentSize     = Size;
            this.prefDialog.DocumentLocation = Location;
            this.prefDialog.DocumentTitle    = Text;

            // Subscribe to the dialog's Apply event
            this.prefDialog.Apply += preferences_Apply;

            // Open Modelessly
            this.prefDialog.Show(this);
        }
Esempio n. 2
0
        void preferences_Apply(object sender, EventArgs e)
        {
            PreferencesDialog preferencesDlg = sender as PreferencesDialog;

            //save changes in document
            this.document.BackColor        = this.prefDialog.BackColor;
            this.document.Font             = this.prefDialog.Font;
            this.document.TextColor        = this.prefDialog.TextColor;
            this.document.DocumentSize     = this.prefDialog.DocumentSize;
            this.document.DocumentLocation = this.prefDialog.DocumentLocation;
            this.document.DocumentTitle    = this.prefDialog.DocumentTitle;


            //apply changes in document
            this.TextBox.Font      = this.document.Font;
            this.TextBox.BackColor = this.document.BackColor;
            this.TextBox.ForeColor = this.document.TextColor;
            this.Size     = this.document.DocumentSize;
            this.Location = this.document.DocumentLocation;
            this.Text     = this.document.DocumentTitle;
        }