From eea0240134f27829aad6fcce46bfcc672625537a Mon Sep 17 00:00:00 2001 From: syneffort Date: Wed, 27 Sep 2023 14:40:54 +0900 Subject: [PATCH] blur text --- PacticeSolution/BlurText/App.xaml | 9 ++++ PacticeSolution/BlurText/App.xaml.cs | 17 +++++++ PacticeSolution/BlurText/AssemblyInfo.cs | 10 ++++ PacticeSolution/BlurText/BlurText.csproj | 10 ++++ PacticeSolution/BlurText/MainWindow.xaml | 29 ++++++++++++ PacticeSolution/BlurText/MainWindow.xaml.cs | 52 +++++++++++++++++++++ PacticeSolution/PacticeSolution.sln | 6 +++ 7 files changed, 133 insertions(+) create mode 100644 PacticeSolution/BlurText/App.xaml create mode 100644 PacticeSolution/BlurText/App.xaml.cs create mode 100644 PacticeSolution/BlurText/AssemblyInfo.cs create mode 100644 PacticeSolution/BlurText/BlurText.csproj create mode 100644 PacticeSolution/BlurText/MainWindow.xaml create mode 100644 PacticeSolution/BlurText/MainWindow.xaml.cs diff --git a/PacticeSolution/BlurText/App.xaml b/PacticeSolution/BlurText/App.xaml new file mode 100644 index 0000000..c684bc4 --- /dev/null +++ b/PacticeSolution/BlurText/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/PacticeSolution/BlurText/App.xaml.cs b/PacticeSolution/BlurText/App.xaml.cs new file mode 100644 index 0000000..06d1a8c --- /dev/null +++ b/PacticeSolution/BlurText/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace BlurText +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/PacticeSolution/BlurText/AssemblyInfo.cs b/PacticeSolution/BlurText/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/PacticeSolution/BlurText/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/PacticeSolution/BlurText/BlurText.csproj b/PacticeSolution/BlurText/BlurText.csproj new file mode 100644 index 0000000..4106cb0 --- /dev/null +++ b/PacticeSolution/BlurText/BlurText.csproj @@ -0,0 +1,10 @@ + + + + WinExe + net6.0-windows + enable + true + + + diff --git a/PacticeSolution/BlurText/MainWindow.xaml b/PacticeSolution/BlurText/MainWindow.xaml new file mode 100644 index 0000000..2db25f3 --- /dev/null +++ b/PacticeSolution/BlurText/MainWindow.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/PacticeSolution/BlurText/MainWindow.xaml.cs b/PacticeSolution/BlurText/MainWindow.xaml.cs new file mode 100644 index 0000000..fd1b18e --- /dev/null +++ b/PacticeSolution/BlurText/MainWindow.xaml.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Timers; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using System.Windows.Threading; + +namespace BlurText +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + private readonly int _width = 150; + + private Timer _timer; + + public MainWindow() + { + InitializeComponent(); + + _timer = new Timer(); + _timer.Interval = 10; + _timer.Elapsed += _timer_Elapsed; + _timer.Start(); + } + + private int _tmpLeftMargin; + private void _timer_Elapsed(object? sender, ElapsedEventArgs e) + { + _tmpLeftMargin++; + if (_tmpLeftMargin >= 150) + _tmpLeftMargin = -1 * _width; + + Dispatcher.Invoke(DispatcherPriority.Normal, () => + { + tbMain.Margin = new Thickness(_tmpLeftMargin, 0, 0, 0); + }); + } + } +} diff --git a/PacticeSolution/PacticeSolution.sln b/PacticeSolution/PacticeSolution.sln index 744b028..1b001ff 100644 --- a/PacticeSolution/PacticeSolution.sln +++ b/PacticeSolution/PacticeSolution.sln @@ -145,6 +145,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Capture", "Capture\Capture. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FakeGoogle", "FakeGoogle\FakeGoogle.csproj", "{CCEBB074-4E79-42C1-83D6-E531B49B3372}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlurText", "BlurText\BlurText.csproj", "{28D8D0D9-7053-4AE3-99A7-C1192511F084}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -435,6 +437,10 @@ Global {CCEBB074-4E79-42C1-83D6-E531B49B3372}.Debug|Any CPU.Build.0 = Debug|Any CPU {CCEBB074-4E79-42C1-83D6-E531B49B3372}.Release|Any CPU.ActiveCfg = Release|Any CPU {CCEBB074-4E79-42C1-83D6-E531B49B3372}.Release|Any CPU.Build.0 = Release|Any CPU + {28D8D0D9-7053-4AE3-99A7-C1192511F084}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28D8D0D9-7053-4AE3-99A7-C1192511F084}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28D8D0D9-7053-4AE3-99A7-C1192511F084}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28D8D0D9-7053-4AE3-99A7-C1192511F084}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE