Controls/RunningText.cs

(开头部分) 14KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Media.Animation;

namespace Micro.Ui.RunningTextStyle.Controls
{
    /// <summary>
    /// 滚动方向
    /// </summary>
    public enum RunningDirection
    {
        /// <summary>
        /// 从右往左
        /// </summary>
        RightToLeft,
        /// <summary>
        /// 从左往右
        /// </summary>
        LeftToRight,
        /// <summary>
        /// 从下往上
        /// </summary>
        BottomToTop,
        /// <summary>
        /// 从上往下
        /// </summary>
        TopToBottom
    }

    /// <summary>
    /// 滚动文字
    /// </summary>
    [ContentProperty("Text")]
    [TemplatePart(Name = "PART_Canvas", Type = typeof(Canvas))]
    [TemplatePart(Name = "PART_Txt1", Type = typeof(TextBlock))]
    [TemplatePart(Name = "PART_Txt2", Type = typeof(TextBlock))]
    public class RunningText : Control
    {
        #region DependencyProperties

        /// <summary>
        /// 滚动的文字
        /// </summary>
        public static readonly DependencyProperty TextProperty = TextBlock.TextProperty.AddOwner(typeof(RunningText));
        /// <summary>
        /// 滚动的文字
        /// </summary>
        public String Text { get => (String)GetValue(TextProperty); set => SetValue(TextProperty, value); }



        /// <summary>
        /// 间距
        /// </summary>
        public static readonly DependencyProperty SpaceProperty = DependencyProperty.Register("Space", typeof(Double), typeof(RunningText), new PropertyMetadata(Double.NaN, OnSpacePropertyChanged));

        private static void OnSpacePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
后面还有 364 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。