lab-3 finished

This commit is contained in:
Zakharov_Rostislav 2024-04-24 12:34:53 +04:00
parent 2db8be3335
commit 3b4f8bba61
5 changed files with 24 additions and 12 deletions

View File

@ -8,13 +8,16 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Resource Include="images\desert.png"> <Resource Include="Resources\images\desert.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="images\desert2.png"> <Resource Include="Resources\images\forest.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="images\forest.png"> <Resource Include="Resources\images\sea.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\images\sea2.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource> </Resource>
</ItemGroup> </ItemGroup>

View File

@ -6,6 +6,11 @@
xmlns:local="clr-namespace:Interfaces" xmlns:local="clr-namespace:Interfaces"
mc:Ignorable="d" mc:Ignorable="d"
Title="SoundBox" Height="450" Width="800"> Title="SoundBox" Height="450" Width="800">
<Window.Resources>
<SolidColorBrush x:Key="ForestBackgroundColor" Color="Olive" />
<SolidColorBrush x:Key="DesertBackgroundColor" Color="LightSalmon" />
<SolidColorBrush x:Key="SeaBackgroundColor" Color="DarkCyan" />
</Window.Resources>
<Grid ShowGridLines="True"> <Grid ShowGridLines="True">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition> <RowDefinition Height="*"></RowDefinition>
@ -21,16 +26,12 @@
VerticalAlignment="Stretch" Orientation="Vertical"> VerticalAlignment="Stretch" Orientation="Vertical">
<Button Margin="10,5,10,5" Padding="3,3,3,3" Click="ButtonForest_Click">Forest</Button> <Button Margin="10,5,10,5" Padding="3,3,3,3" Click="ButtonForest_Click">Forest</Button>
<Button Margin="10,5,10,5" Padding="3,3,3,3" Click="ButtonDesert_Click">Desert</Button> <Button Margin="10,5,10,5" Padding="3,3,3,3" Click="ButtonDesert_Click">Desert</Button>
<Button Margin="10,5,10,5" Padding="3,3,3,3">Jungle</Button> <Button Margin="10,5,10,5" Padding="3,3,3,3" Click="ButtonSea_Click">Sea</Button>
<Button Margin="10,5,10,5" Padding="3,3,3,3">Tundra</Button>
<Button Margin="10,5,10,5" Padding="3,3,3,3">Taiga</Button>
<Button Margin="10,5,10,5" Padding="3,3,3,3">Steppe</Button>
<Button Margin="10,5,10,5" Padding="3,3,3,3">Mountains</Button>
<Button Margin="10,5,10,5" Padding="3,3,3,3">Sea</Button>
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
</Border> </Border>
<DockPanel Name="PanelMenu" Grid.Row="0" Grid.Column="1" Background="Olive"> <DockPanel Name="PanelMenu" Grid.Row="0" Grid.Column="1"
Background="{StaticResource SeaBackgroundColor}">
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal"
HorizontalAlignment="Center" VerticalAlignment="Center"> HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Margin="10,5,10,5" Padding="3,3,3,3">Execute</Button> <Button Margin="10,5,10,5" Padding="3,3,3,3">Execute</Button>
@ -38,7 +39,7 @@
</StackPanel> </StackPanel>
<DockPanel Background="Black"> <DockPanel Background="Black">
<Viewbox> <Viewbox>
<Image Name="ImageNature" Source="/Resources/images/desert.png"/> <Image Name="ImageNature" Source="/Resources/images/sea.png"/>
</Viewbox> </Viewbox>
</DockPanel> </DockPanel>
</DockPanel> </DockPanel>

View File

@ -18,12 +18,20 @@ namespace Interfaces
private void ButtonDesert_Click(object sender, RoutedEventArgs e) private void ButtonDesert_Click(object sender, RoutedEventArgs e)
{ {
ImageNature.Source = new BitmapImage(new Uri("/Resources/images/desert.png", UriKind.Relative)); ImageNature.Source = new BitmapImage(new Uri("/Resources/images/desert.png", UriKind.Relative));
PanelMenu.Background = (Brush)TryFindResource("DesertBackgroundColor");
} }
private void ButtonForest_Click(object sender, RoutedEventArgs e) private void ButtonForest_Click(object sender, RoutedEventArgs e)
{ {
ImageNature.Source = new BitmapImage(new Uri("/Resources/images/forest.png", UriKind.Relative)); ImageNature.Source = new BitmapImage(new Uri("/Resources/images/forest.png", UriKind.Relative));
PanelMenu.Background = (Brush)TryFindResource("ForestBackgroundColor");
}
private void ButtonSea_Click(object sender, RoutedEventArgs e)
{
ImageNature.Source = new BitmapImage(new Uri("/Resources/images/sea.png", UriKind.Relative));
PanelMenu.Background = (Brush)TryFindResource("SeaBackgroundColor");
} }
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB