最近开始做WPF界面使用Grid显示图像,通过鼠标画框对部分图像进行选择
xaml代码
<Window x:Class="GridImageSelect.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="411" Width="525">
<Grid>
<Border BorderBrush="Black" BorderThickness="1" Height="300" HorizontalAlignment="Left" Margin="41,34,0,0" Name="border1" VerticalAlignment="Top" Width="300">
<Grid Name="grid1" MouseLeftButtonDown="grid1_MouseLeftButtonDown" MouseLeftButtonUp="grid1_MouseLeftButtonUp" MouseMove="grid1_MouseMove" Loaded="grid1_Loaded" />
</Border>
<Button Content="重画选框" Height="37" HorizontalAlignment="Left" Margin="356,177,0,0" Name="button1" VerticalAlignment="Top" Width="135" Click="button1_Click" />
<Label Content="点击位置:" Height="28" HorizontalAlignment="Left" Margin="356,35,0,0" Name="label1" VerticalAlignment="Top" Width="135" />
<Label Content="离开位置" Height="28" HorizontalAlignment=&