XFEstudio/MyFirstRespo
添加文本滚动控件
a3b79df
代码差异
16 个文件
+498
-10
二进制文件已变更,无法进行逐行预览。
二进制文件已变更,无法进行逐行预览。
二进制文件已变更,无法进行逐行预览。
@@ -0,0 +1,99 @@
1
//------------------------------------------------------------------------------
2
// <auto-generated>
3
// 此代码由工具生成。
4
// 运行时版本:4.0.30319.42000
5
//
6
// 对此文件的更改可能会导致不正确的行为,并且如果
7
// 重新生成代码,这些更改将会丢失。
8
// </auto-generated>
9
//------------------------------------------------------------------------------
10
11
namespace XFEToolBox.Resources.Resource {
12
using System;
13
14
15
/// <summary>
16
/// 一个强类型的资源类,用于查找本地化的字符串等。
17
/// </summary>
18
// 此类是由 StronglyTypedResourceBuilder
19
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
20
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
21
// (以 /str 作为命令选项),或重新生成 VS 项目。
22
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25
internal class DownloadInfoResource {
26
27
private static global::System.Resources.ResourceManager resourceMan;
28
29
private static global::System.Globalization.CultureInfo resourceCulture;
30
31
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32
internal DownloadInfoResource() {
33
}
34
35
/// <summary>
36
/// 返回此类使用的缓存的 ResourceManager 实例。
37
/// </summary>
38
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39
internal static global::System.Resources.ResourceManager ResourceManager {
40
get {
41
if (object.ReferenceEquals(resourceMan, null)) {
42
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("XFEToolBox.Resources.Resource.DownloadInfoResource", typeof(DownloadInfoResource).Assembly);
43
resourceMan = temp;
44
}
45
return resourceMan;
46
}
47
}
48
49
/// <summary>
50
/// 重写当前线程的 CurrentUICulture 属性,对
51
/// 使用此强类型资源类的所有资源查找执行重写。
52
/// </summary>
53
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54
internal static global::System.Globalization.CultureInfo Culture {
55
get {
56
return resourceCulture;
57
}
58
set {
59
resourceCulture = value;
60
}
61
}
62
63
/// <summary>
64
/// 查找类似 URL:https://d1vdn3r1396bak.cloudfront.net/installer/615515/8160454381798 的本地化字符串。
65
/// </summary>
66
internal static string CheatEngine {
67
get {
68
return ResourceManager.GetString("CheatEngine", resourceCulture);
69
}
70
}
71
72
/// <summary>
73
/// 查找类似 URL:https://cdn.akamai.steamstatic.com/client/installer/SteamSetup.exe 的本地化字符串。
74
/// </summary>
75
internal static string Steam {
76
get {
77
return ResourceManager.GetString("Steam", resourceCulture);
78
}
79
}
80
81
/// <summary>
82
/// 查找类似 URL:https://apps.microsoft.com/0d4d1483-85ee-45ff-a2ef-f5cad41db2c8 的本地化字符串。
83
/// </summary>
84
internal static string Steampp {
85
get {
86
return ResourceManager.GetString("Steampp", resourceCulture);
87
}
88
}
89
90
/// <summary>
91
/// 查找类似 URL:https://c2rsetup.officeapps.live.com/c2r/downloadVS.aspx?sku=community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030:932d79d8269b49daac423040f7b7a9d4 的本地化字符串。
92
/// </summary>
93
internal static string VisualStudio {
94
get {
95
return ResourceManager.GetString("VisualStudio", resourceCulture);
96
}
97
}
98
}
99
}
@@ -0,0 +1,132 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<root>
3
<!--
4
Microsoft ResX Schema
5
6
Version 2.0
7
8
The primary goals of this format is to allow a simple XML format
9
that is mostly human readable. The generation and parsing of the
10
various data types are done through the TypeConverter classes
11
associated with the data types.
12
13
Example:
14
15
... ado.net/XML headers & schema ...
16
<resheader name="resmimetype">text/microsoft-resx</resheader>
17
<resheader name="version">2.0</resheader>
18
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
<value>[base64 mime encoded serialized .NET Framework object]</value>
24
</data>
25
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
<comment>This is a comment</comment>
28
</data>
29
30
There are any number of "resheader" rows that contain simple
31
name/value pairs.
32
33
Each data row contains a name, and value. The row also contains a
34
type or mimetype. Type corresponds to a .NET class that support
35
text/value conversion through the TypeConverter architecture.
36
Classes that don't support this are serialized and stored with the
37
mimetype set.
38
39
The mimetype is used for serialized objects, and tells the
40
ResXResourceReader how to depersist the object. This is currently not
41
extensible. For a given mimetype the value must be set accordingly:
42
43
Note - application/x-microsoft.net.object.binary.base64 is the format
44
that the ResXResourceWriter will generate, however the reader can
45
read any of the formats listed below.
46
47
mimetype: application/x-microsoft.net.object.binary.base64
48
value : The object must be serialized with
49
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
: and then encoded with base64 encoding.
51
52
mimetype: application/x-microsoft.net.object.soap.base64
53
value : The object must be serialized with
54
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
: and then encoded with base64 encoding.
56
57
mimetype: application/x-microsoft.net.object.bytearray.base64
58
value : The object must be serialized into a byte array
59
: using a System.ComponentModel.TypeConverter
60
: and then encoded with base64 encoding.
61
-->
62
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
<xsd:element name="root" msdata:IsDataSet="true">
65
<xsd:complexType>
66
<xsd:choice maxOccurs="unbounded">
67
<xsd:element name="metadata">
68
<xsd:complexType>
69
<xsd:sequence>
70
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71
</xsd:sequence>
72
<xsd:attribute name="name" use="required" type="xsd:string" />
73
<xsd:attribute name="type" type="xsd:string" />
74
<xsd:attribute name="mimetype" type="xsd:string" />
75
<xsd:attribute ref="xml:space" />
76
</xsd:complexType>
77
</xsd:element>
78
<xsd:element name="assembly">
79
<xsd:complexType>
80
<xsd:attribute name="alias" type="xsd:string" />
81
<xsd:attribute name="name" type="xsd:string" />
82
</xsd:complexType>
83
</xsd:element>
84
<xsd:element name="data">
85
<xsd:complexType>
86
<xsd:sequence>
87
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
</xsd:sequence>
90
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
<xsd:attribute ref="xml:space" />
94
</xsd:complexType>
95
</xsd:element>
96
<xsd:element name="resheader">
97
<xsd:complexType>
98
<xsd:sequence>
99
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
</xsd:sequence>
101
<xsd:attribute name="name" type="xsd:string" use="required" />
102
</xsd:complexType>
103
</xsd:element>
104
</xsd:choice>
105
</xsd:complexType>
106
</xsd:element>
107
</xsd:schema>
108
<resheader name="resmimetype">
109
<value>text/microsoft-resx</value>
110
</resheader>
111
<resheader name="version">
112
<value>2.0</value>
113
</resheader>
114
<resheader name="reader">
115
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
</resheader>
117
<resheader name="writer">
118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
</resheader>
120
<data name="Steam" xml:space="preserve">
121
<value>URL:https://cdn.akamai.steamstatic.com/client/installer/SteamSetup.exe</value>
122
</data>
123
<data name="Steampp" xml:space="preserve">
124
<value>URL:https://apps.microsoft.com/0d4d1483-85ee-45ff-a2ef-f5cad41db2c8</value>
125
</data>
126
<data name="VisualStudio" xml:space="preserve">
127
<value>URL:https://c2rsetup.officeapps.live.com/c2r/downloadVS.aspx?sku=community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030:932d79d8269b49daac423040f7b7a9d4</value>
128
</data>
129
<data name="CheatEngine" xml:space="preserve">
130
<value>URL:https://d1vdn3r1396bak.cloudfront.net/installer/615515/8160454381798</value>
131
</data>
132
</root>
@@ -1,9 +1,12 @@
1
1
using System.Windows.Media;
2
2
using System.Windows;
3
using System.IO;
4
using System.Xml;
5
using System.Windows.Markup;
3
6
4
7
namespace XFEToolBox.Utilities;
5
8
6
public class ControlHelper
9
public static class ControlHelper
7
10
{
8
11
public static T? FindControlByTag<T>(DependencyObject parent, object tag) where T : FrameworkElement
9
12
{
@@ -22,4 +25,5 @@ public class ControlHelper
22
25
}
23
26
return null;
24
27
}
28
public static T Clone<T>(this T control) where T : UIElement => (T)XamlReader.Load(XmlReader.Create(new StringReader(XamlWriter.Save(control))));
25
29
}
@@ -9,4 +9,9 @@ public static class ScrollViewerBehavior
9
9
public static void SetVerticalOffset(FrameworkElement target, double value) => target.SetValue(VerticalOffsetProperty, value);
10
10
public static double GetVerticalOffset(FrameworkElement target) => (double)target.GetValue(VerticalOffsetProperty);
11
11
private static void OnVerticalOffsetChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) => (target as ScrollViewer)?.ScrollToVerticalOffset((double)e.NewValue);
12
13
public static readonly DependencyProperty HorizontalOffsetProperty = DependencyProperty.RegisterAttached("HorizontalOffset", typeof(double), typeof(ScrollViewerBehavior), new UIPropertyMetadata(0d, OnHorizontalOffsetChanged));
14
public static void SetHorizontalOffset(FrameworkElement target, double value) => target.SetValue(HorizontalOffsetProperty, value);
15
public static double GetHorizontalOffset(FrameworkElement target) => (double)target.GetValue(HorizontalOffsetProperty);
16
private static void OnHorizontalOffsetChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) => (target as ScrollViewer)?.ScrollToHorizontalOffset((double)e.NewValue);
12
17
}
@@ -12,7 +12,7 @@
12
12
<RowDefinition Height="Auto"/>
13
13
<RowDefinition Height="25"/>
14
14
</Grid.RowDefinitions>
15
<Button Width="50" Height="50" Command="{Binding Command,ElementName=toolButton}">
15
<Button Width="50" Height="50" Command="{Binding Command,ElementName=toolButton}" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave">
16
16
<Button.Style>
17
17
<Style TargetType="Button">
18
18
<Setter Property="Template">
@@ -26,14 +26,14 @@
26
26
<Border.Effect>
27
27
<BlurEffect Radius="10"/>
28
28
</Border.Effect>
29
<Image Width="45" Height="45" Source="{Binding IconSource,ElementName=toolButton}" VerticalAlignment="Center" HorizontalAlignment="Center">
29
<Image Width="45" Height="45" Source="{Binding IconSource,ElementName=toolButton,FallbackValue=/Resources/Image/wrench_tool.png}" VerticalAlignment="Center" HorizontalAlignment="Center">
30
30
<Image.Clip>
31
31
<RectangleGeometry RadiusX="10" RadiusY="10" Rect="0,0,45,45"/>
32
32
</Image.Clip>
33
33
</Image>
34
34
</Border>
35
35
<Border CornerRadius="10" BorderThickness="2" BorderBrush="#5050b7" Padding="3">
36
<Image Source="{Binding IconSource,ElementName=toolButton}">
36
<Image Source="{Binding IconSource,ElementName=toolButton,FallbackValue=/Resources/Image/wrench_tool.png}">
37
37
<Image.Clip>
38
38
<RectangleGeometry RadiusX="10" RadiusY="10" Rect="0,0,40,40"/>
39
39
</Image.Clip>
@@ -104,6 +104,6 @@
104
104
</ProgressBar.Clip>
105
105
</ProgressBar>
106
106
</Border>
107
<TextBlock Grid.Row="2" Text="{Binding ToolName,ElementName=toolButton}" Foreground="{Binding TextColor,ElementName=toolButton}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
107
<local:ScrollTextBlock x:Name="scrollTextBlock" AutoRolling="False" Grid.Row="2" InnerText="{Binding ToolName,ElementName=toolButton}" InnerForeground="{Binding TextColor,ElementName=toolButton}" MaxWidth="50" RollingBack="True" RollingTimeMillisecond="3000"/>
108
108
</Grid>
109
109
</UserControl>
@@ -108,4 +108,8 @@ public partial class MiniToolButton : UserControl
108
108
{
109
109
InitializeComponent();
110
110
}
111
112
private void Button_MouseEnter(object sender, MouseEventArgs e) => scrollTextBlock.IsRolling = scrollTextBlock.NeedRolling;
113
114
private void Button_MouseLeave(object sender, MouseEventArgs e) => scrollTextBlock.IsRolling = false;
111
115
}
@@ -0,0 +1,14 @@
1
<UserControl x:Class="XFEToolBox.Views.Controls.ScrollTextBlock"
2
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6
xmlns:local="clr-namespace:XFEToolBox.Views.Controls"
7
mc:Ignorable="d"
8
d:DesignHeight="450" d:DesignWidth="800" Name="scrollTextBlock" Loaded="ScrollTextBlock_Loaded">
9
<ScrollViewer x:Name="scrollViewer" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled" MaxWidth="{Binding MaxWidth, ElementName=scrollTextBlock}" MinWidth="{Binding MinWidth, ElementName=scrollTextBlock}" Width="{Binding Width,ElementName=scrollTextBlock}" Height="{Binding Height,ElementName=scrollTextBlock}">
10
<StackPanel x:Name="stackPanel" Orientation="Horizontal">
11
<TextBlock x:Name="textBlock" Foreground="{Binding InnerForeground, ElementName=scrollTextBlock}" Background="{Binding InnerBackground, ElementName=scrollTextBlock}" Text="{Binding InnerText, ElementName=scrollTextBlock}" FontSize="{Binding InnerFontSize, ElementName=scrollTextBlock}" FontFamily="{Binding InnerFontFamily, ElementName=scrollTextBlock}" FontWeight="{Binding InnerFontWeight, ElementName=scrollTextBlock}" TextAlignment="{Binding InnerTextAlignment, ElementName=scrollTextBlock}" TextDecorations="{Binding InnerTextDecorations, ElementName=scrollTextBlock}" VerticalAlignment="{Binding InnerTextVerticalAlignment, ElementName=scrollTextBlock}" HorizontalAlignment="{Binding InnerTextHorizontalAlignment, ElementName=scrollTextBlock}"/>
12
</StackPanel>
13
</ScrollViewer>
14
</UserControl>
@@ -0,0 +1,207 @@
1
using System.Windows;
2
using System.Windows.Controls;
3
using System.Windows.Media;
4
using System.Windows.Media.Animation;
5
using XFEToolBox.Utilities;
6
using XFEToolBox.Views.Behavior;
7
8
namespace XFEToolBox.Views.Controls;
9
10
/// <summary>
11
/// ScrollTextBlock.xaml 的交互逻辑
12
/// </summary>
13
public partial class ScrollTextBlock : UserControl
14
{
15
#region DependencyProperty
16
public double RollingTimeMillisecond
17
{
18
get { return (double)GetValue(RollingTimeMillisecondProperty); }
19
set { SetValue(RollingTimeMillisecondProperty, value); }
20
}
21
public static readonly DependencyProperty RollingTimeMillisecondProperty = DependencyProperty.Register("RollingTimeMillisecond", typeof(double), typeof(ScrollTextBlock), new PropertyMetadata(5000d));
22
23
public bool AutoAlignment
24
{
25
get { return (bool)GetValue(AutoAlignmentProperty); }
26
set { SetValue(AutoAlignmentProperty, value); }
27
}
28
public static readonly DependencyProperty AutoAlignmentProperty = DependencyProperty.Register("AutoAlignment", typeof(bool), typeof(ScrollTextBlock), new PropertyMetadata(true));
29
30
public bool RollingBack
31
{
32
get { return (bool)GetValue(RollingBackProperty); }
33
set { SetValue(RollingBackProperty, value); }
34
}
35
public static readonly DependencyProperty RollingBackProperty = DependencyProperty.Register("RollingBack", typeof(bool), typeof(ScrollTextBlock), new PropertyMetadata(false));
36
37
public bool NeedRolling
38
{
39
get { return (bool)GetValue(NeedRollingProperty); }
40
set { SetValue(NeedRollingProperty, value); }
41
}
42
public static readonly DependencyProperty NeedRollingProperty = DependencyProperty.Register("NeedRolling", typeof(bool), typeof(UserControl), new PropertyMetadata(false));
43
44
public bool IsRolling
45
{
46
get { return (bool)GetValue(IsRollingProperty); }
47
set { SetValue(IsRollingProperty, value); if (IsRolling) StartRolling(); else EndRolling(); }
48
}
49
public static readonly DependencyProperty IsRollingProperty = DependencyProperty.Register("IsRolling", typeof(bool), typeof(ScrollTextBlock), new PropertyMetadata(false));
50
51
public bool AutoRolling
52
{
53
get { return (bool)GetValue(AutoRollingProperty); }
54
set { SetValue(AutoRollingProperty, value); }
55
}
56
public static readonly DependencyProperty AutoRollingProperty = DependencyProperty.Register("AutoRolling", typeof(bool), typeof(ScrollTextBlock), new PropertyMetadata(true));
57
58
public string InnerText
59
{
60
get { return (string)GetValue(InnerTextProperty); }
61
set { SetValue(InnerTextProperty, value); }
62
}
63
public static readonly DependencyProperty InnerTextProperty = DependencyProperty.Register("InnerText", typeof(string), typeof(ScrollTextBlock), new PropertyMetadata("请输入文本"));
64
65
public Brush InnerForeground
66
{
67
get { return (Brush)GetValue(InnerForegroundProperty); }
68
set { SetValue(InnerForegroundProperty, value); }
69
}
70
public static readonly DependencyProperty InnerForegroundProperty = DependencyProperty.Register("InnerForeground", typeof(Brush), typeof(ScrollTextBlock), new PropertyMetadata(new SolidColorBrush(Colors.Black)));
71
72
public Brush InnerBackground
73
{
74
get { return (Brush)GetValue(InnerBackgroundProperty); }
75
set { SetValue(InnerBackgroundProperty, value); }
76
}
77
public static readonly DependencyProperty InnerBackgroundProperty = DependencyProperty.Register("InnerBackground", typeof(Brush), typeof(ScrollTextBlock), new PropertyMetadata(new SolidColorBrush(Colors.Transparent)));
78
79
public double InnerFontSize
80
{
81
get { return (double)GetValue(InnerFontSizeProperty); }
82
set { SetValue(InnerFontSizeProperty, value); }
83
}
84
public static readonly DependencyProperty InnerFontSizeProperty = DependencyProperty.Register("InnerFontSize", typeof(double), typeof(ScrollTextBlock), new PropertyMetadata(13d));
85
86
public FontFamily InnerFontFamily
87
{
88
get { return (FontFamily)GetValue(InnerFontFamilyProperty); }
89
set { SetValue(InnerFontFamilyProperty, value); }
90
}
91
public static readonly DependencyProperty InnerFontFamilyProperty = DependencyProperty.Register("InnerFontFamily", typeof(FontFamily), typeof(ScrollTextBlock), new PropertyMetadata(new FontFamily()));
92
93
public FontWeight InnerFontWeight
94
{
95
get { return (FontWeight)GetValue(InnerFontWeightProperty); }
96
set { SetValue(InnerFontWeightProperty, value); }
97
}
98
public static readonly DependencyProperty InnerFontWeightProperty = DependencyProperty.Register("InnerFontWeight", typeof(FontWeight), typeof(ScrollTextBlock), new PropertyMetadata(new FontWeight()));
99
100
public Thickness InnerTextMargin
101
{
102
get { return (Thickness)GetValue(InnerTextMarginProperty); }
103
set { SetValue(InnerTextMarginProperty, value); }
104
}
105
public static readonly DependencyProperty InnerTextMarginProperty = DependencyProperty.Register("InnerTextMargin", typeof(Thickness), typeof(ScrollTextBlock), new PropertyMetadata(new Thickness(10, 0, 0, 0)));
106
107
public double InnerTextOpacity
108
{
109
get { return (double)GetValue(InnerTextOpacityProperty); }
110
set { SetValue(InnerTextOpacityProperty, value); }
111
}
112
public static readonly DependencyProperty InnerTextOpacityProperty = DependencyProperty.Register("InnerTextOpacity", typeof(double), typeof(ScrollTextBlock), new PropertyMetadata(0.5d));
113
114
public VerticalAlignment InnerTextVerticalAlignment
115
{
116
get { return (VerticalAlignment)GetValue(InnerTextVerticalAlignmentProperty); }
117
set { SetValue(InnerTextVerticalAlignmentProperty, value); }
118
}
119
public static readonly DependencyProperty InnerTextVerticalAlignmentProperty = DependencyProperty.Register("InnerTextVerticalAlignment", typeof(VerticalAlignment), typeof(ScrollTextBlock), new PropertyMetadata(VerticalAlignment.Center));
120
121
public HorizontalAlignment InnerTextHorizontalAlignment
122
{
123
get { return (HorizontalAlignment)GetValue(InnerTextHorizontalAlignmentProperty); }
124
set { SetValue(InnerTextHorizontalAlignmentProperty, value); }
125
}
126
public static readonly DependencyProperty InnerTextHorizontalAlignmentProperty = DependencyProperty.Register("InnerTextHorizontalAlignment", typeof(HorizontalAlignment), typeof(ScrollTextBlock), new PropertyMetadata(HorizontalAlignment.Center));
127
128
public TextAlignment InnerTextAlignment
129
{
130
get { return (TextAlignment)GetValue(InnerTextAlignmentProperty); }
131
set { SetValue(InnerTextAlignmentProperty, value); }
132
}
133
public static readonly DependencyProperty InnerTextAlignmentProperty = DependencyProperty.Register("InnerTextAlignment", typeof(TextAlignment), typeof(ScrollTextBlock), new PropertyMetadata(TextAlignment.Center));
134
135
public TextDecorationCollection InnerTextDecorations
136
{
137
get { return (TextDecorationCollection)GetValue(InnerTextDecorationsProperty); }
138
set { SetValue(InnerTextDecorationsProperty, value); }
139
}
140
public static readonly DependencyProperty InnerTextDecorationsProperty = DependencyProperty.Register("InnerTextDecorations", typeof(TextDecorationCollection), typeof(ScrollTextBlock), new PropertyMetadata(null));
141
#endregion
142
143
TextAlignment originalTextAlignment = TextAlignment.Center;
144
145
public ScrollTextBlock()
146
{
147
InitializeComponent();
148
originalTextAlignment = InnerTextAlignment;
149
}
150
151
private void ScrollTextBlock_Loaded(object sender, RoutedEventArgs e)
152
{
153
if (textBlock.ActualWidth > scrollViewer.ActualWidth)
154
{
155
if (AutoAlignment)
156
{
157
InnerTextAlignment = TextAlignment.Left;
158
originalTextAlignment = InnerTextAlignment;
159
}
160
NeedRolling = true;
161
if (AutoRolling || IsRolling)
162
StartRolling();
163
}
164
else
165
{
166
if (AutoAlignment)
167
{
168
InnerTextAlignment = TextAlignment.Center;
169
originalTextAlignment = InnerTextAlignment;
170
}
171
}
172
}
173
174
public void StartRolling()
175
{
176
SetValue(IsRollingProperty, true);
177
textBlock.TextAlignment = TextAlignment.Left;
178
if (!RollingBack)
179
{
180
textBlock.Width = textBlock.ActualWidth + scrollViewer.ActualWidth;
181
if (stackPanel.Children.Count > 1) stackPanel.Children.RemoveAt(1);
182
var copyOfTextBlock = textBlock.Clone();
183
stackPanel.Children.Add(copyOfTextBlock);
184
}
185
var animation = new DoubleAnimation()
186
{
187
From = 0,
188
To = RollingBack ? textBlock.ActualWidth - scrollViewer.ActualWidth : textBlock.ActualWidth + scrollViewer.ActualWidth,
189
Duration = TimeSpan.FromMilliseconds(RollingTimeMillisecond),
190
RepeatBehavior = RepeatBehavior.Forever,
191
AutoReverse = RollingBack
192
};
193
scrollViewer.BeginAnimation(ScrollViewerBehavior.HorizontalOffsetProperty, animation);
194
}
195
196
public void EndRolling()
197
{
198
SetValue(IsRollingProperty, false);
199
InnerTextAlignment = originalTextAlignment;
200
if (!RollingBack)
201
{
202
textBlock.Width = textBlock.ActualWidth;
203
if (stackPanel.Children.Count > 1) stackPanel.Children.RemoveAt(1);
204
}
205
scrollViewer.BeginAnimation(ScrollViewerBehavior.HorizontalOffsetProperty, null);
206
}
207
}
@@ -11,12 +11,15 @@
11
11
Title="DownloadPage" d:DataContext="{d:DesignInstance Type=viewmodel:DownloadPageViewModel}">
12
12
13
13
<Grid>
14
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
14
<ScrollViewer HorizontalScrollBarVisibility="Disabled" Padding="5">
15
15
<ScrollViewer.Resources>
16
16
<Style TargetType="ScrollBar" BasedOn="{StaticResource ConsoleScrollBar}"/>
17
17
</ScrollViewer.Resources>
18
18
<WrapPanel>
19
<ctr:MiniToolButton ToolName="Steam" IconSource="/Resources/Image/steam_logo.png"/>
19
<ctr:MiniToolButton ToolName="Steam" IconSource="/Resources/Image/DownloadImage/steam_logo.png" Tag="Steam"/>
20
<ctr:MiniToolButton ToolName="Steam++(Watt Toolkit)" IconSource="/Resources/Image/DownloadImage/steampp.png" Tag="Steampp"/>
21
<ctr:MiniToolButton ToolName="Visual Studio" IconSource="/Resources/Image/DownloadImage/visual_studio.png" Tag="VisualStudio"/>
22
<ctr:MiniToolButton ToolName="Cheat Engine" IconSource="/Resources/Image/DownloadImage/cheat_engine.png" Tag="CheatEngine"/>
20
23
</WrapPanel>
21
24
</ScrollViewer>
22
25
</Grid>
@@ -15,6 +15,5 @@ public partial class DownloadPage : Page
15
15
Current = this;
16
16
DataContext = ViewModel = new(this);
17
17
InitializeComponent();
18
//Steam链接:https://cdn.akamai.steamstatic.com/client/installer/SteamSetup.exe
19
18
}
20
19
}
@@ -22,7 +22,6 @@
22
22
<Border Grid.Row="1" Grid.ColumnSpan="2" CornerRadius="15" Background="White" Margin="10">
23
23
<ScrollViewer VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Disabled" Padding="5">
24
24
<WrapPanel>
25
<ctr:MiniToolButton IconSource="/Resources/Image/steam_logo.png"/>
26
25
</WrapPanel>
27
26
</ScrollViewer>
28
27
</Border>
@@ -21,6 +21,10 @@
21
21
<None Remove="Resources\Image\console.png" />
22
22
<None Remove="Resources\Image\corner.png" />
23
23
<None Remove="Resources\Image\download.png" />
24
<None Remove="Resources\Image\DownloadImage\cheat_engine.png" />
25
<None Remove="Resources\Image\DownloadImage\steampp.png" />
26
<None Remove="Resources\Image\DownloadImage\visualstudio.png" />
27
<None Remove="Resources\Image\DownloadImage\visual_studio.png" />
24
28
<None Remove="Resources\Image\grid.png" />
25
29
<None Remove="Resources\Image\invisible.png" />
26
30
<None Remove="Resources\Image\min.png" />
@@ -57,13 +61,16 @@
57
61
<Resource Include="Resources\Image\console.png" />
58
62
<Resource Include="Resources\Image\corner.png" />
59
63
<Resource Include="Resources\Image\download.png" />
64
<Resource Include="Resources\Image\DownloadImage\cheat_engine.png" />
65
<Resource Include="Resources\Image\DownloadImage\steampp.png" />
66
<Resource Include="Resources\Image\DownloadImage\visual_studio.png" />
60
67
<Resource Include="Resources\Image\grid.png" />
61
68
<Resource Include="Resources\Image\invisible.png" />
62
69
<Resource Include="Resources\Image\min.png" />
63
70
<Resource Include="Resources\Image\restart.png" />
64
71
<Resource Include="Resources\Image\setting.png" />
65
72
<Resource Include="Resources\Image\start.png" />
66
<Resource Include="Resources\Image\steam_logo.png" />
73
<Resource Include="Resources\Image\DownloadImage\steam_logo.png" />
67
74
<Resource Include="Resources\Image\stop.png" />
68
75
<Resource Include="Resources\Image\tabline.png" />
69
76
</ItemGroup>
@@ -85,4 +92,19 @@
85
92
<Resource Include="Resources\Image\wrench_tool.png" />
86
93
</ItemGroup>
87
94
95
<ItemGroup>
96
<Compile Update="Resources\Resource\DownloadInfoResource.Designer.cs">
97
<DesignTime>True</DesignTime>
98
<AutoGen>True</AutoGen>
99
<DependentUpon>DownloadInfoResource.resx</DependentUpon>
100
</Compile>
101
</ItemGroup>
102
103
<ItemGroup>
104
<EmbeddedResource Update="Resources\Resource\DownloadInfoResource.resx">
105
<Generator>ResXFileCodeGenerator</Generator>
106
<LastGenOutput>DownloadInfoResource.Designer.cs</LastGenOutput>
107
</EmbeddedResource>
108
</ItemGroup>
109
88
110
</Project>