Exemple #1
0
        private void TextEditor_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(TextObject.Text))
            {
                TextObject = DefaultTextobject;
            }

            int i             = 0;
            int selectedIndex = 0;

            foreach (FontFamily oneFontFamily in FontFamily.Families)
            {
                FontName.Items.Add(oneFontFamily.Name);
                if (TextObject.FontName == oneFontFamily.Name)
                {
                    selectedIndex = i;
                }
                i++;
            }

            FontName.SelectedIndex = selectedIndex;

            FontSize.Text = TextObject.FontSize.ToString();

            FontBold.Checked   = TextObject.Bold;
            FontItalic.Checked = TextObject.Italic;
            borderStyle        = TextObject.BorderStyle;

            textBox.ForeColor = UiTools.RgbOnlyColor(TextObject.ForegroundColor);
            textBox.BackColor = UiTools.RgbOnlyColor(TextObject.BackgroundColor);

            TextBackgroundColor = TextObject.BackgroundColor;
            TextForegroundColor = TextObject.ForegroundColor;
            textBox.Text        = TextObject.Text;

            initialized = true;
            UpdateTextCharacteristics();
        }