internal static TextObject FromXml(XmlNode node)
 {
     var newTextObject = new TextObject();
     newTextObject.Text = node.InnerText;
     newTextObject.BorderStyle = TextBorderStyle.None;
     newTextObject.Bold = Convert.ToBoolean(node.Attributes["Bold"].Value);
     newTextObject.Italic = Convert.ToBoolean(node.Attributes["Italic"].Value);
     newTextObject.Underline = Convert.ToBoolean(node.Attributes["Underline"].Value);
     newTextObject.FontSize = Convert.ToSingle(node.Attributes["FontSize"].Value);
     newTextObject.FontName = node.Attributes["FontName"].Value;
     newTextObject.ForegroundColor = SavedColor.Load(node.Attributes["ForgroundColor"].Value);
     newTextObject.BackgroundColor = SavedColor.Load(node.Attributes["BackgroundColor"].Value);
     if (node.Attributes["BorderStyle"] != null)
     {
         newTextObject.BorderStyle = (TextBorderStyle)(Enum.Parse(typeof(TextBorderStyle), node.Attributes["BorderStyle"].Value));
     }
     return newTextObject;
 }
        public override void InitializeFromXml(XmlNode node)
        {
            XmlNode text = node["Text"];

            TextObject = TextObject.FromXml(text["TextObject"]);
        }
 public TextOverlay(TextObject textObject)
 {
     this.TextObject = textObject;
     this.Name = textObject.Text.Split(new char[] {'\r','\n'})[0];
     X = 0;
     Y = 0;
 }
        public bool AddText(string p, TextObject textObject)
        {
            if (tour == null || tour.CurrentTourStop == null)
            {
                return false;
            }

            TextOverlay text = new TextOverlay( textObject);
            text.Color = textObject.ForegroundColor;
            text.X = 960;
            text.Y = 600;
            //todo localize
            Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(547, "Insert Text"), tour));
            tour.CurrentTourStop.AddOverlay(text);
            OverlayList.UpdateOverlayList(tour.CurrentTourStop, Selection);
            return true;
        }
        private void TextEditor_Load(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(TextObject.Text))
            {
                TextObject = DefaultTextobject;
            }

            var i = 0;
            var selectedIndex = 0;
            foreach (var 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();
        }
        private void SaveButton_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            float fontSize = (int)textBox.Font.Size;
            try
            {
                fontSize = Convert.ToSingle(FontSize.Text);
            }
            catch
            {
            }

            TextObject = new TextObject(textBox.Text, FontBold.Checked, FontItalic.Checked, false, fontSize, FontName.SelectedItem.ToString(), TextForegroundColor, TextBackgroundColor, borderStyle);
            DefaultTextobject = TextObject;
            DefaultTextobject.Text = "";
            Close();
        }
示例#7
0
 public TextOverlay(TextObject textObject)
 {
     TextObject = textObject;
     Name = textObject.Text.Split(new[] {'\r','\n'})[0];
     X = 0;
     Y = 0;
 }