blur text
This commit is contained in:
9
PacticeSolution/BlurText/App.xaml
Normal file
9
PacticeSolution/BlurText/App.xaml
Normal file
@@ -0,0 +1,9 @@
|
||||
<Application x:Class="BlurText.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:BlurText"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
17
PacticeSolution/BlurText/App.xaml.cs
Normal file
17
PacticeSolution/BlurText/App.xaml.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
10
PacticeSolution/BlurText/AssemblyInfo.cs
Normal file
10
PacticeSolution/BlurText/AssemblyInfo.cs
Normal file
@@ -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)
|
||||
)]
|
10
PacticeSolution/BlurText/BlurText.csproj
Normal file
10
PacticeSolution/BlurText/BlurText.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
29
PacticeSolution/BlurText/MainWindow.xaml
Normal file
29
PacticeSolution/BlurText/MainWindow.xaml
Normal file
@@ -0,0 +1,29 @@
|
||||
<Window x:Class="BlurText.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:BlurText"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Border Width="150" Height="150" Background="#4D5056">
|
||||
<Grid>
|
||||
<TextBlock x:Name="tbMain" Text="This is test text..." Foreground="White" VerticalAlignment="Center"
|
||||
FontWeight="Bold" FontSize="15"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border SnapsToDevicePixels="True" Margin="-20 0 0 0" Background="#4D5056" Width="50">
|
||||
<Border.Effect>
|
||||
<BlurEffect Radius="20"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<Border Background="#4D5056" Margin="90 0 0 0" Width="50">
|
||||
<Border.Effect>
|
||||
<BlurEffect Radius="20"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
52
PacticeSolution/BlurText/MainWindow.xaml.cs
Normal file
52
PacticeSolution/BlurText/MainWindow.xaml.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user