void _font_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.Name.IndexOf("Font.") == -1)
     {
         e.Name = "Font." + e.Name;
     }
     _font = sender as FontWrapper;
     base.OnPropertyChanged(this, e);
 }
 public ShapeFontBase(SignType signType)
     : base(signType)
 {
     _font                        = new FontWrapper();
     _textEffect                  = new TextEffect();
     _font.PropertyChanged       += new EventHandler <PropertyChangedEventArgs>(_font_PropertyChanged);
     _textEffect.PropertyChanged += new EventHandler <PropertyChangedEventArgs>(_textEffect_PropertyChanged);
     _foreColor                   = SignTypeHandler.ConvertColor(Color.BlueViolet, SignType);
     //_foreColor = Color.BlueViolet;
 }
 private void Deserialized(StreamingContext ctx)
 {
     if (_font == null)
     {
         _font                        = new FontWrapper();
         _textEffect                  = new TextEffect();
         _font.PropertyChanged       += new EventHandler <PropertyChangedEventArgs>(_font_PropertyChanged);
         _textEffect.PropertyChanged += new EventHandler <PropertyChangedEventArgs>(_textEffect_PropertyChanged);
     }
     InitEvent();
 }
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (_font != null)
     {
         _font.PropertyChanged       -= this._font_PropertyChanged;
         _textEffect.PropertyChanged -= this._textEffect_PropertyChanged;
         _font.Name  = null;
         _font       = null;
         _textEffect = null;
     }
 }
 public override void InitEvent()
 {
     if (_font == null)
     {
         _font = new FontWrapper();
     }
     _font.PropertyChanged += new EventHandler <PropertyChangedEventArgs>(_font_PropertyChanged);
     if (_textEffect == null)
     {
         _textEffect = new TextEffect();
     }
     _textEffect.PropertyChanged += new EventHandler <PropertyChangedEventArgs>(_textEffect_PropertyChanged);
 }
Exemple #6
0
        public static FontWrapper GetFontMeasureStringSize(
            string text
            , FontWrapper font
            , RectangleF bounds
            , StringFormat stringFormat
            , bool wordWrap
            , Graphics graphics)
        {
            Font tmp = GetFontMeasureStringSize(text, font.ToFont(), bounds, stringFormat, wordWrap, graphics);

            font.FromFont(tmp);
            return(font);
        }
        public override void FromTo(ShapeBase shape)
        {
            if (shape == null)
            {
                return;
            }
            base.FromTo(shape);

            ShapeFontBase shapeFont = shape as ShapeFontBase;

            if (shapeFont != null)
            {
                FontWrapper oldFont = _font;
                if (_font.IsHasEvent)
                {
                    _font = shapeFont._font.Copy();
                    _font.PropertyChanged += new EventHandler <PropertyChangedEventArgs>(_font_PropertyChanged);
                }
                else
                {
                    _font = shapeFont._font.Copy();
                }

                _backColor = shapeFont._backColor;
                _foreColor = shapeFont._foreColor;
                if (shapeFont.TextEffect.IsHasEvent)
                {
                    _textEffect = shapeFont.TextEffect.Copy();
                    _textEffect.PropertyChanged += new EventHandler <PropertyChangedEventArgs>(_textEffect_PropertyChanged);
                }
                else
                {
                    _textEffect = shapeFont.TextEffect.Copy();
                }
            }
        }