private void formatFontMenuItem_Click(object sender, RoutedEventArgs e)
        {
            // Instantiate the dialog box
            var dlg = new FontDialogBox
            {
                Owner      = this,
                FontFamily = documentTextBox.FontFamily,
                FontSize   = documentTextBox.FontSize,
                FontWeight = documentTextBox.FontWeight,
                FontStyle  = documentTextBox.FontStyle
            };

            // Configure the dialog box

            // Open the dialog box modally
            dlg.ShowDialog();

            // Process data entered by user if dialog box is accepted
            if (dlg.DialogResult == true)
            {
                // Update fonts
                documentTextBox.FontFamily = dlg.FontFamily;
                documentTextBox.FontSize   = dlg.FontSize;
                documentTextBox.FontWeight = dlg.FontWeight;
                documentTextBox.FontStyle  = dlg.FontStyle;
            }
        }
Exemple #2
0
        private void formatFontMenuItem_Click(object sender, RoutedEventArgs e)
        {
            // Instantiate the dialog box
            var dlg = new FontDialogBox
            {
                Owner = this,
                FontFamily = documentTextBox.FontFamily,
                FontSize = documentTextBox.FontSize,
                FontWeight = documentTextBox.FontWeight,
                FontStyle = documentTextBox.FontStyle
            };

            // Configure the dialog box

            // Open the dialog box modally 
            dlg.ShowDialog();

            // Process data entered by user if dialog box is accepted
            if (dlg.DialogResult == true)
            {
                // Update fonts
                documentTextBox.FontFamily = dlg.FontFamily;
                documentTextBox.FontSize = dlg.FontSize;
                documentTextBox.FontWeight = dlg.FontWeight;
                documentTextBox.FontStyle = dlg.FontStyle;
            }
        }