You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
6.7 KiB
XML

<Window x:Class="CommonFunc.HMessageBox"
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:CommonFunc"
mc:Ignorable="d"
Title="HMessageBox" Height="210" Width="420" WindowStartupLocation="CenterScreen" WindowStyle="None" BorderThickness="1,1,1,1" ResizeMode="NoResize" Closed="Window_Closed" Loaded="Window_Loaded">
<Window.Resources>
<Style x:Key="btnKey" TargetType="Button">
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="43"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Back" Background="#2B7EE6" BorderThickness="2" CornerRadius="10">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Back" Property="Background" Value="#3697A4"></Setter>
<Setter TargetName="Back" Property="BorderBrush" Value="#3697A4"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="btnCancelKey" TargetType="Button">
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="43"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Template" >
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="Back" Background="LightGray" BorderThickness="2" CornerRadius="10">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Back" Property="Background" Value="#3697A4"></Setter>
<Setter TargetName="Back" Property="BorderBrush" Value="#3697A4"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<!--显示图片和文本-->
<StackPanel Grid.Row="0" VerticalAlignment="Center" Orientation="Horizontal">
<!--<Image x:Name="MsgImg" Width="62" Height="62" Margin="40,20,20,20" >
<Image.Triggers>
<EventTrigger RoutedEvent="Loaded">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="1" To="0" Duration="0:0:1.5" Storyboard.TargetProperty="Opacity"/>
</Storyboard>
</BeginStoryboard>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="0" To="1" Duration="0:0:1.5" Storyboard.TargetProperty="Opacity"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Image.Triggers>
</Image>-->
<Image x:Name="MsgImg" Width="62" Height="62" Margin="40,20,20,20">
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded" >
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="MsgImg" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:1" AutoReverse="True" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
<TextBlock VerticalAlignment="Center" x:Name="TxtMsg" HorizontalAlignment="Left" Foreground="Black" TextWrapping="WrapWithOverflow" Width="280" TextAlignment="Left"
FontSize="18"/>
</StackPanel>
<Border BorderBrush="#FF34268A" BorderThickness="0,0.8,0,0"></Border>
<!--Button Margin(坐上右下)-->
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" >
<Button Content="确 定" Background="#216DD3" BorderBrush="Transparent" x:Name="OkButton" Style="{StaticResource btnKey}" Width="80" Height="28" FontWeight="Bold" Foreground="White" Click="OkButton_Click" Margin="10,0,0,0" IsDefault="True"
/>
<Button Content="是" Background="#216DD3" BorderBrush="Transparent" x:Name="YesButton" Width="80" Height="28" FontWeight="Bold" Click="YesButton_Click" Margin="10,0,0,0"
/>
<Button Content="否" Background="#D7D7D7" Foreground="Black" BorderBrush="Transparent" BorderThickness="0.5" x:Name="NoButton" Width="80" Height="28" FontWeight="Bold" Click="NoButton_Click" Margin="10,0,15,0"
/>
<Button Content="取消" Background="#D7D7D7" Foreground="Black" BorderBrush="Transparent" BorderThickness="0.5" x:Name="CancelButton" Style="{StaticResource btnCancelKey}" Width="80" Height="28" FontWeight="Bold" Click="CancelButton_Click" Margin="10,0,25,0"
/>
</StackPanel>
</Grid>
</Window>