void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.GradientStop1 = ((System.Windows.Media.GradientStop)(target));
                return;

            case 2:
                this.TextBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.RealText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this.MyTextEffect = ((System.Windows.Media.TextEffect)(target));
                return;

            case 5:
                this.TextEffectSkewTransform = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 6:
                this.ReflectedText = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 7:
                this.timeTextBlock = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Beispiel #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 4 "..\..\MainWindow.xaml"
                ((动画.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.TextBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.RealText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this.MyTextEffect = ((System.Windows.Media.TextEffect)(target));
                return;

            case 5:
                this.TextEffectSkewTransform = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 6:
                this.ReflectedText = ((System.Windows.Shapes.Rectangle)(target));
                return;
            }
            this._contentLoaded = true;
        }
        public AnimationforText()
        {
            InitializeComponent();

            this.Loaded += (sender, e) =>
            {
                Storyboard perChar = new Storyboard();
                tbTest.TextEffects = new TextEffectCollection();
                for (Int32 i = 0; i < tbTest.Text.Length; i++)
                {
                    TextEffect effect = new TextEffect();
                    effect.Transform = new TranslateTransform();
                    effect.PositionStart = i;
                    effect.PositionCount = 1;
                    tbTest.TextEffects.Add(effect);

                    DoubleAnimation anim = new DoubleAnimation();
                    anim.To = 5;
                    anim.AccelerationRatio = 0.2;
                    anim.DecelerationRatio = 0.2;
                    anim.RepeatBehavior = RepeatBehavior.Forever;
                    anim.AutoReverse = true;
                    anim.Duration = TimeSpan.FromMilliseconds(1);
                    anim.BeginTime = TimeSpan.FromMilliseconds(250* i);
                    Storyboard.SetTargetProperty(anim, new PropertyPath("TextEffects[" + i + "].Transform.Y"));
                    Storyboard.SetTargetName(anim, tbTest.Name);
                    perChar.Children.Add(anim);
                }

                perChar.Begin(this);
            };
        }
Beispiel #4
0
        //---------------------------
        // public static methods
        //---------------------------
        
        /// <summary>
        /// resolves text effect on a text range to a list of text effect targets.
        /// The method will walk the text and perform the following task:
        /// 1) For each continous block of text, create a text effect targeting the scoping element
        /// 2) For the text effect created, calculate the starting cp index and cp count for the effect
        /// 
        /// The method will create freezable copy of the TextEffect passed in and fill in 
        /// CharacterIndex and Count for the range.
        /// </summary>
        /// <param name="startPosition">starting text pointer</param>
        /// <param name="endPosition">end text pointer</param>
        /// <param name="effect">effect that is apply on the text</param>
        public static TextEffectTarget[] Resolve(
            TextPointer             startPosition, 
            TextPointer             endPosition,
            TextEffect              effect
            )
        {
            if (effect == null)
                throw new ArgumentNullException("effect");

            ValidationHelper.VerifyPositionPair(startPosition, endPosition);            
            TextPointer   effectStart   = new TextPointer(startPosition);            

            // move to the first character symbol at or after Start position
            MoveToFirstCharacterSymbol(effectStart);

            TextEffect effectCopy;
            List<TextEffectTarget> list = new List<TextEffectTarget>();

            // we will now traverse the TOM and resolve text effects to the immediate parent 
            // of the characters. We are effectively applying the text effect onto 
            // block of continous text.
            while (effectStart.CompareTo(endPosition) < 0)
            {   
                // create a copy of the text effect 
                // so that we can set the CharacterIndex and Count
                effectCopy                 = effect.Clone();

                // create a position
                TextPointer continuousTextEnd = new TextPointer(effectStart);
                
                // move the position to the end of the continuous text block
                MoveToFirstNonCharacterSymbol(continuousTextEnd, endPosition);

                // make sure we are not out of the range
                continuousTextEnd = (TextPointer)TextPointerBase.Min(continuousTextEnd, endPosition);

                // set the character index to be the distance from the Start 
                // of this text block to the Start of the text container
                effectCopy.PositionStart = effectStart.TextContainer.Start.GetOffsetToPosition(effectStart);

                // count is the distance from the text block start to end
                effectCopy.PositionCount = effectStart.GetOffsetToPosition(continuousTextEnd);

                list.Add(
                    new TextEffectTarget(
                        effectStart.Parent, 
                        effectCopy
                        )
                 );
                
                // move the effectStart to the beginning of the next text block.
                effectStart = continuousTextEnd;
                MoveToFirstCharacterSymbol(effectStart);
            }

            return list.ToArray();
        }
Beispiel #5
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MyBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 2:
                this.MyTextBlock = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 3:
                this.mytexteffect = ((System.Windows.Media.TextEffect)(target));
                return;

            case 4:
                this.texteffecttransform = ((System.Windows.Media.SkewTransform)(target));
                return;
            }
            this._contentLoaded = true;
        }
Beispiel #6
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.TextBorder = ((System.Windows.Controls.Border)(target));
                return;

            case 2:
                this.RealText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 3:
                this.MyTextEffect = ((System.Windows.Media.TextEffect)(target));
                return;

            case 4:
                this.TextEffectSkewTransform = ((System.Windows.Media.SkewTransform)(target));
                return;

            case 5:
                this.ReflectedText = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 6:
                this.userNameBox = ((System.Windows.Controls.TextBox)(target));
                return;

            case 7:

            #line 220 "..\..\LoginDialog.xaml"
                ((System.Windows.Controls.PasswordBox)(target)).PasswordChanged += new System.Windows.RoutedEventHandler(this.PasswordBox_OnPasswordChanged);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Beispiel #7
0
 private void EnableTextEffects(TextBlock tb, TextEffect effect)
 {
     _textEffectTargets = TextEffectResolver.Resolve(tb.ContentStart, tb.ContentEnd, effect);
     foreach (TextEffectTarget target in _textEffectTargets)
         target.Enable();
 }
Beispiel #8
0
        // Begin TextEffect methods
        public void teTranslate(object sender, RoutedEventArgs e)
        {
            DisableTextEffects();

            TextEffect myEffect = new TextEffect();
            myEffect.PositionStart = 0;
            myEffect.PositionCount = 999;
            TranslateTransform myTranslateTransform = new TranslateTransform(50,50);
            myEffect.Transform = myTranslateTransform;

            EnableTextEffects(tb1, myEffect);
            tb2.Text = "The TranslateTransform applied moved the TextBlock to an offset position of 50,50.";
        }
Beispiel #9
0
        public void teScale(object sender, RoutedEventArgs e)
        {
            DisableTextEffects();

            TextEffect myEffect = new TextEffect();
            myEffect.PositionStart = 0;
            myEffect.PositionCount = 999;
            ScaleTransform myScaleTransform = new ScaleTransform(5,5);
            myEffect.Transform = myScaleTransform;

            EnableTextEffects(tb1, myEffect);
            tb2.Text = "The ScaleTransform applied scaled the text by a factor of 5.";
        }
Beispiel #10
0
        public void teRotate(object sender, RoutedEventArgs e)
        {
            DisableTextEffects();

            TextEffect myEffect = new TextEffect();
            myEffect.PositionStart = 0;
            myEffect.PositionCount = 999;
            RotateTransform myRotateTransform = new RotateTransform(45);
            myEffect.Transform = myRotateTransform;

            EnableTextEffects(tb1, myEffect);
            tb2.Text = "The RotateTransform applied rotated the text by 45 degrees.";
        }
 public SequencePanel()
 {
     InitializeComponent();
     leading = new TextEffect(Transform.Identity, greyText, null, 0, 0);
     trailing = new TextEffect(Transform.Identity, greyText, null, 0, 0);
 }
        //corregir, si hay lección nueva, se espera espacio y el usuario erra, pinta la primer letra
        private void animarTexto()
        {
            TextEffectCollection colecciónEfectos = new TextEffectCollection();
            TextEffect efecto = new TextEffect();

            if (!adminAct.swhayLecciónNueva) //si no es lección nueva
            {
                efecto.PositionStart = posiciónCarácterActualEnPalabra;
            }
            else
            {
                efecto.PositionStart = txtTexto.Text.Length - textoEspacio.Length;
            }


            if (posiciónCarácterActualEnPalabra < txtTexto.Text.Length - textoEspacio.Length && !adminAct.swhayLecciónNueva) //si está en la palabra y no es una lección nueva
                efecto.PositionCount = 1;
            else
                efecto.PositionCount = textoEspacio.Length;



            //ScaleTransform transformación = new ScaleTransform(2, 2);
            //efecto.Transform = transformación;
            efecto.Foreground = seleccionarPincelAnimación();
            colecciónEfectos.Add(efecto);
            txtTexto.TextEffects = colecciónEfectos;
        }
Beispiel #13
0
        internal TextEffectTarget(
            DependencyObject element,          
            TextEffect       effect
            )
        {
            if (element == null)
                throw new ArgumentNullException("element");

            if (effect == null)
                throw new ArgumentNullException("effect");
            
            _element = element;
            _effect  = effect;
        }
Beispiel #14
0
        private void SetTextEffect(TextBlock target, int idx)
        {
            if (target.TextEffects == null)
            {
                target.TextEffects = new TextEffectCollection();
            }

            TextEffect effect = new TextEffect
            {
                Foreground = new SolidColorBrush(((SolidColorBrush)target.Foreground).Color),
                PositionStart = idx,
                PositionCount = 1
            };

            target.TextEffects.Add(effect);
        }
Beispiel #15
0
 private void EnableTextEffects(FlowDocument fd, TextEffect effect)
 {
     _textEffectTargets = TextEffectResolver.Resolve(fd.ContentStart, fd.ContentEnd, effect);
     foreach (var target in _textEffectTargets)
         target.Enable();
 }