Fix for bug [#1457]

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2463 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2013-02-06 12:22:31 +00:00
commit c6f3438a16

View file

@ -35,14 +35,19 @@ namespace Greenshot.Drawing {
/// <summary> /// <summary>
/// Represents a textbox (extends RectangleContainer for border/background support /// Represents a textbox (extends RectangleContainer for border/background support
/// </summary> /// </summary>
[Serializable()] [Serializable]
public class TextContainer : RectangleContainer, ITextContainer { public class TextContainer : RectangleContainer, ITextContainer {
private bool fontInvalidated = true; private bool fontInvalidated = true;
// If makeUndoable is true the next text-change will make the change undoable. // If makeUndoable is true the next text-change will make the change undoable.
// This is set to true AFTER the first change is made, as there is already a "add element" on the undo stack // This is set to true AFTER the first change is made, as there is already a "add element" on the undo stack
private bool makeUndoable = false; private bool makeUndoable = false;
private Font font; private Font font;
StringFormat stringFormat = new StringFormat();
/// <summary>
/// The StringFormat object is not serializable!!
/// </summary>
[NonSerialized]
StringFormat stringFormat;
private string text; private string text;
// there is a binding on the following property! // there is a binding on the following property!
@ -79,12 +84,13 @@ namespace Greenshot.Drawing {
AddField(GetType(), FieldType.FONT_SIZE, 11f); AddField(GetType(), FieldType.FONT_SIZE, 11f);
AddField(GetType(), FieldType.TEXT_HORIZONTAL_ALIGNMENT, HorizontalAlignment.Center); AddField(GetType(), FieldType.TEXT_HORIZONTAL_ALIGNMENT, HorizontalAlignment.Center);
AddField(GetType(), FieldType.TEXT_VERTICAL_ALIGNMENT, VerticalAlignment.CENTER); AddField(GetType(), FieldType.TEXT_VERTICAL_ALIGNMENT, VerticalAlignment.CENTER);
stringFormat = new StringFormat();
stringFormat.Trimming = StringTrimming.EllipsisWord; stringFormat.Trimming = StringTrimming.EllipsisWord;
} }
[OnDeserializedAttribute()] [OnDeserializedAttribute]
private void OnDeserialized(StreamingContext context) { private void OnDeserialized(StreamingContext context) {
stringFormat = new StringFormat();
Init(); Init();
UpdateFormat(); UpdateFormat();
} }