Example #1
0
 private void UpdateSelection(Settings.FontSetting selected)
 {
     currentlySelectedFontSetting = selected;
     cbxFontSize.SelectedItem     = selected.Font.Size;
     cbxFont.SelectedItem         = selected.Font.Name;
     cbxForeground.SelectedItem   = selected.ForeColor;
     cbxBackground.SelectedItem   = selected.BackColor;
     cbxBold.Checked   = selected.Font.Bold;
     cbxItalic.Checked = selected.Font.Italic;
 }
Example #2
0
        private Settings.FontSetting GetPreviewFontSettings()
        {
            float     fontSize  = SystemFonts.DefaultFont.Size;
            string    fontName  = SystemFonts.DefaultFont.Name;
            Color     backColor = SystemColors.Window;
            Color     foreColor = SystemColors.ControlText;
            FontStyle style     = FontStyle.Regular;

            if (cbxFontSize.SelectedItem is float)
            {
                fontSize = (float)cbxFontSize.SelectedItem;
            }
            if (cbxFont.SelectedItem is string)
            {
                fontName = (string)cbxFont.SelectedItem;
            }
            if (cbxForeground.SelectedItem is Color)
            {
                foreColor = (Color)cbxForeground.SelectedItem;
            }
            if (cbxBackground.SelectedItem is Color)
            {
                backColor = (Color)cbxBackground.SelectedItem;
            }

            if (cbxBold.Checked)
            {
                style |= FontStyle.Bold;
            }
            if (cbxItalic.Checked)
            {
                style |= FontStyle.Italic;
            }

            var previewFontSettings = new Settings.FontSetting()
            {
                Name      = string.Empty,
                Font      = new Font(fontName, fontSize, style),
                ForeColor = foreColor,
                BackColor = backColor
            };

            return(previewFontSettings);
        }