MainWindow.xaml
<Window x:Class="FaceCapture.MainWindow" xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration" xmlns:aforge ="clr-namespace:AForge.Controls;assembly=AForge.Controls" xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" xmlns:my="clr-namespace:Splash;assembly=FingerPictureBox" Title="FaceCapture(WPF)" mc:Ignorable="d" xmlns:d="https://schemas.microsoft.com/expression/blend/2008" xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="480" d:DesignWidth="902" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" AllowDrop="True" Closing="Window_Closing"> <Grid AllowDrop="True"> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid Grid.Column="0" AllowDrop="False"> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <wfi:WindowsFormsHost Grid.Row="0" Margin="5"> <aforge:VideoSourcePlayer x:Name="sourcePlayer" Width="300" Height="360"> </aforge:VideoSourcePlayer> </wfi:WindowsFormsHost> <StackPanel Grid.Row="1" Orientation="Horizontal" Height="60" HorizontalAlignment="Stretch" > <Button Name="button_Play" Height="40" Width="120" Margin="40,10,20,10" Click="button_Play_Click"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <Image Name="image_Play" Width="32" Height="32" /> <Label Name="label_Play" Content="开启摄像头" VerticalContentAlignment="Center" FontSize="14" /> </StackPanel> </Button> <Button Name="button_Capture" Height="40" Width="120" Margin="40,10,40,10" Click="button_Capture_Click"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <Image Name="image_Capture" Width="32" Height="32" /> <Label Content="抓拍图像" VerticalContentAlignment="Center" FontSize="14" /> </StackPanel> </Button> </StackPanel> </Grid> <Grid Grid.Column="1"> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <StackPanel Grid.Row="0" Orientation="Horizontal"> <my:FingerPictureBox Height="210" Name="fingerPictureBox1" Width="210" BorderThickness="5" BorderBrush="DarkGreen" Margin="5" /> <my:FingerPictureBox Height="210" Name="fingerPictureBox2" Width="210" BorderThickness="5" BorderBrush="DarkGreen" Margin="5" /> </StackPanel> <StackPanel Grid.Row="1" Orientation="Horizontal"> <my:FingerPictureBox Height="210" Name="fingerPictureBox3" Width="210" BorderThickness="5" BorderBrush="DarkGreen" Margin="5" /> <my:FingerPictureBox Height="210" Name="fingerPictureBox4" Width="210" BorderThickness="5" BorderBrush="DarkGreen" Margin="5" /> </StackPanel> </Grid> </Grid></Window><Window