Controls/RunningBlock.cs

(开头部分) 10KB

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

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

namespace Micro.Ui.RunningTextStyle.Controls
{
    /// <summary>
    /// 滚动块
    /// </summary>
    [TemplatePart(Name = "PART_Canvas", Type = typeof(Canvas))]
    [TemplatePart(Name = "PART_Content", Type = typeof(ContentPresenter))]
    [TemplatePart(Name = "PART_Mirror", Type = typeof(FrameworkElement))]
    public class RunningBlock : ContentControl
    {
        #region DependencyProperties

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

        private static void OnSpacePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((RunningBlock)d).BeginUpdate();
        }

        /// <summary>
        /// 间距
        /// </summary>
        public Double Space { get => (Double)GetValue(SpaceProperty); set => SetValue(SpaceProperty, value); }



        /// <summary>
        /// 滚动速度(每秒wpf单位数)
        /// </summary>
        public static readonly DependencyProperty SpeedProperty = RunningText.SpeedProperty.AddOwner(typeof(RunningBlock), new PropertyMetadata(120d, OnSpeedPropertyChanged));

        private static void OnSpeedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((RunningBlock)d).BeginUpdate();
        }

        /// <summary>
        /// 滚动速度(每秒wpf单位数)
        /// </summary>
        public Double Speed { get => (Double)GetValue(SpeedProperty); set => SetValue(SpeedProperty, value); }



        /// <summary>
        /// 滚动方向
        /// </summary>
        public static readonly DependencyProperty DirectionProperty = RunningText.DirectionProperty.AddOwner(typeof(RunningBlock), new PropertyMetadata(RunningDirection.RightToLeft, OnDirectionPropertyChanged));

        private static void OnDirectionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((RunningBlock)d).BeginUpdate();
        }
后面还有 253 行代码,购买后查看完整代码

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

AI 解读 AI

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

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