问题遇到的现象和发生背景
.net C# vs2019 WPF 多幅图像拼接时,中间有白线
问题相关代码,请勿粘贴截图
<Window x:Class="WpfAppframework.MainWindow"
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:WpfAppframework"
mc:Ignorable="d"
Title="MainWindow" Height="710" Width="640" Loaded="Window_Loaded">
<Grid x:Name="main" Width="1920">
<Grid.RowDefinitions>
<RowDefinition Height="1920"/>
</Grid.RowDefinitions>
<TextBlock x:Name="textBlock" Grid.Column="0" HorizontalAlignment="Left" Margin="0,0,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="20" Width="1622" Panel.ZIndex="1" FontSize="15" FontWeight="Bold" Foreground="#FF00F516"/>
<TextBlock x:Name="textBlock1" Grid.Column="0" HorizontalAlignment="Left" Margin="0,20,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Height="20" Width="1622" Panel.ZIndex="1" FontSize="15" FontWeight="Bold" Foreground="#FF00F516"/>
<Grid x:Name="MainPanel" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Top" Height="1920"
MouseLeftButtonDown="MasterImage_MouseLeftButtonDown"
MouseLeftButtonUp="MasterImage_MouseLeftButtonUp"
MouseMove="MasterImage_MouseMove"
MouseWheel="MasterImage_MouseWheel" Margin="-640,-640,0,0">
<Grid.RenderTransform>
<TransformGroup >
<MatrixTransform x:Name="mtf"></MatrixTransform>
</TransformGroup>
</Grid.RenderTransform>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Grid.Column="0" x:Name="image00" Margin="0,0,0,0" Source="D:\shuju\image1z\21_10.jpg"/>
<Image Grid.Row="0" Grid.Column="1" x:Name="image01" Margin="0,0,0,0" Source="D:\shuju\image1z\21_11.jpg"/>
<Image Grid.Row="0" Grid.Column="2" x:Name="image02" Margin="0,0,0,0" Source="D:\shuju\image1z\21_12.jpg"/>
<Image Grid.Row="1" Grid.Column="0" x:Name="image10" Margin="0,0,0,0" Source="D:\shuju\image1z\22_10.jpg"/>
<Image Grid.Row="1" Grid.Column="1" x:Name="image11" Margin="0,0,0,0" Source="D:\shuju\image1z\22_11.jpg" Opacity="1" />
<Image Grid.Row="1" Grid.Column="2" x:Name="image12" Margin="0,0,0,0" Source="D:\shuju\image1z\22_12.jpg"/>
<Image Grid.Row="2" Grid.Column="0" x:Name="image20" Margin="0,0,0,0" Source="D:\shuju\image1z\23_10.jpg"/>
<Image Grid.Row="2" Grid.Column="1" x:Name="image21" Margin="0,0,0,0" Source="D:\shuju\image1z\23_11.jpg"/>
<Image Grid.Row="2" Grid.Column="2" x:Name="image22" Margin="0,0,0,0" Source="D:\shuju\image1z\23_12.jpg"/>
</Grid>
</Grid>
</Window>
运行结果及报错内容
多幅图像拼接时,中间有白线
我的解答思路和尝试过的方法
<Grid Height="640" Width="1280">
<Image x:Name="image11" HorizontalAlignment="Left" Width="640" Margin="0,0,0,0" Source="D:\shuju\image1\22_11.jpg" />
<Image x:Name="image12" HorizontalAlignment="Left" Width="640" Margin="640,0,0,0" Source="D:\shuju\image1\22_12.jpg"/>
</Grid>
像上面的方式拼接图像则没有白线,但是写代码会很麻烦
我想要达到的结果
我感觉Grid的拼接方式,应该能去掉白线,但是查了很多资料,没有结果,希望各路大师帮忙看下