Added some style

This commit is contained in:
Laurent
2026-02-17 10:35:36 +01:00
parent 77d33e4c8f
commit b81d912cf4
4 changed files with 92 additions and 63 deletions

View File

@@ -3,6 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GifResizer"> xmlns:local="clr-namespace:GifResizer">
<Application.Resources> <Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Views/Resources/Style.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources> </Application.Resources>
</Application> </Application>

View File

@@ -10,6 +10,15 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" /> <PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
<PackageReference Include="WpfAnimatedGif" Version="2.0.2" />
</ItemGroup>
<ItemGroup>
<Page Update="Views\Resources\Style.xaml">
<Generator>MSBuild:Compile</Generator>
<XamlRuntime>Wpf</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup> </ItemGroup>

View File

@@ -3,77 +3,71 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:gif="http://wpfanimatedgif.codeplex.com"
mc:Ignorable="d" mc:Ignorable="d"
Title="Gif resizer" Height="480" Width="640" Title="Gif resizer" Height="480" Width="640"
ResizeMode="NoResize"> ResizeMode="NoResize">
<Border BorderBrush="Gray" <Grid>
BorderThickness="1" <Grid.RowDefinitions>
CornerRadius="5" <RowDefinition Height="3*"/>
Padding="5" <RowDefinition Height="1*"/>
Margin="20"> </Grid.RowDefinitions>
<StackPanel Orientation="Vertical" Margin="20"> <Border Grid.Row="0" BorderBrush="Gray"
BorderThickness="1"
<Border BorderBrush="Gray" CornerRadius="5"
Margin="10 10 10 5">
<Grid Style="{StaticResource DarkGrid}">
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Image gif:ImageBehavior.AnimatedSource="{Binding FilePath}"
Stretch="Uniform"
Visibility="{Binding FilePath}"/>
<Button Grid.Row="0"
Style="{StaticResource LinkButtonStyle}"
Click="BrowseButton_Click"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock Text="Browse files"
Width="Auto"
Height="Auto"
TextDecorations="Underline"/>
</Button>
<TextBlock Grid.Row="1"
Margin="0,0,0,5"
Text="{Binding FilePath,
TargetNullValue=No file selected,
FallbackValue=Gif filepath...}"
Width="Auto"
Height="Auto"
HorizontalAlignment="Left"
VerticalAlignment="Center"/>
</Grid>
</Border>
<Border Grid.Row="1" BorderBrush="Gray"
BorderThickness="1" BorderThickness="1"
CornerRadius="5" CornerRadius="5"
Padding="5" Padding="5"
Margin="20"> Margin="10 5 10 10">
<StackPanel Orientation="Vertical"> <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock <StackPanel Orientation="Horizontal">
Margin="0,0,0,5" <CheckBox Content="112x112" IsChecked="True" Margin="10"/>
Text="{ <CheckBox Content="500x500" IsChecked="True" Margin="10"/>
Binding FilePath, <CheckBox Content="1000x1000" IsChecked="True" Margin="10"/>
TargetNullValue=No file selected, </StackPanel>
FallbackValue=Gif filepath... <Button
}" Style="{StaticResource ButtonStyle}"
Width="Auto" Content="Resize"
Height="Auto" Click="ResizeButton_Click"
HorizontalAlignment="Left"
VerticalAlignment="Center"
/>
<Button
Content="Browse..."
Padding="5"
Width="Auto"
Height="Auto"
Click="BrowseButton_Click"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"/> VerticalAlignment="Center"/>
</StackPanel> </StackPanel>
</Border> </Border>
</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<CheckBox Content="112x112" Margin="10"/>
<CheckBox Content="500x500" Margin="10"/>
<CheckBox Content="1000x1000" Margin="10"/>
</StackPanel>
<Button
Content="Resize"
Padding="5"
Width="Auto"
Height="Auto"
Click="ResizeButton_Click"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<!--
<TextBlock Grid.Row="3" Text="Options:" Margin="0,0,0,5"/>
<CheckBox Grid.Row="4"
Content="Optimize file size"
Margin="0,0,0,15"/>
<Button Grid.Row="5"
Content="Resize GIF"
Width="120"
Height="35"
HorizontalAlignment="Left"
VerticalAlignment="Top"/>
-->
</StackPanel>
</Border>
</Window> </Window>

View File

@@ -0,0 +1,22 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="DarkGrid" TargetType="Grid">
<Setter Property="Background" Value="#F7F8F7" />
</Style>
<Style x:Key="ButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#BA2D0B"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Padding" Value="5"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="Auto"/>
</Style>
<Style x:Key="LinkButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="Auto"/>
</Style>
</ResourceDictionary>