Example #1
0
        private void WindowLoaded(object sender, EventArgs e)
        {
            // Enumerate the fonts and add them to the font family combobox.
            foreach (System.Windows.Media.FontFamily fontFamily in Fonts.SystemFontFamilies)
            {
                fontFamilyCB.Items.Add(fontFamily.Source);
            }
            fontFamilyCB.SelectedIndex = 7;

            // Load the font size combo box with common font sizes.
            for (int i = 0; i < CommonFontSizes.Length; i++)
            {
                fontSizeCB.Items.Add(CommonFontSizes[i]);
            }
            fontSizeCB.SelectedIndex = 21;

            //Load capitals combo box
            typographyMenuBar.Visibility = Visibility.Collapsed;

            //Set up the initial render state of the drawn text.
            if (_currentRendering == null)
            {
                _currentRendering = new FontRendering(
                    (double)fontSizeCB.SelectedItem,
                    TextAlignment.Left,
                    null,
                    System.Windows.Media.Brushes.Black,
                    new Typeface("Arial"));
            }

            // Initialize the text store.
            if (_textStore == null)
            {
                _textStore = new CustomTextSource();
            }

            _UILoaded = true; //All UI is loaded, can handle events now
            UpdateFormattedText();
        }
        private void WindowLoaded(object sender, EventArgs e)
        {
            // Enumerate the fonts and add them to the font family combobox.
             foreach (System.Windows.Media.FontFamily fontFamily in Fonts.SystemFontFamilies)
             {
            fontFamilyCB.Items.Add(fontFamily.Source);
             }
             fontFamilyCB.SelectedIndex = 7;

             // Load the font size combo box with common font sizes.
             for (int i=0; i < CommonFontSizes.Length; i++)
             {
            fontSizeCB.Items.Add(CommonFontSizes[i]);
             }
             fontSizeCB.SelectedIndex = 21;

             //Load capitals combo box
             typographyMenuBar.Visibility = Visibility.Collapsed;

             //Set up the initial render state of the drawn text.
             if (_currentRendering == null)
             {
            _currentRendering = new FontRendering(
               (double)fontSizeCB.SelectedItem,
               TextAlignment.Left,
               null,
               System.Windows.Media.Brushes.Black,
               new Typeface("Arial"));
             }

             // Initialize the text store.
             if (_textStore == null)
            _textStore = new CustomTextSource();

             _UILoaded = true;    //All UI is loaded, can handle events now
             UpdateFormattedText();
        }