WPF怎么设置这个image控件居中,我用HorizontalAlignment.Center和VerticalAlignment.Center设了没反应
<Grid><Grid.RowDefinitions><RowDefinitionHeight="20"/><RowDefinitionName="main"Height...
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Name="main" Height="*"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<Menu Name="menu1" MinWidth="500" Grid.Row="0"/>
<Image Name="image1" Grid.Row="1" RenderTransform="{DynamicResource InitialMatrixTransform}"
IsManipulationEnabled="True" Source="/multi_touch;component/Images/1.gif" Margin="107,54,296,114" ManipulationInertiaStarting="im_inertia_starting" ManipulationDelta="im_delta" ManipulationCompleted="im_completed" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Button Name="button1" Grid.Row="2" MinWidth="50" Content="下一幅" HorizontalAlignment="Right" Click="button1_Click" >
</Button>
<Button Name="button2" Grid.Row="2" MinWidth="50" Content="上一幅" HorizontalAlignment="Center" Click="button2_Click" />
</Grid> 展开
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Name="main" Height="*"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<Menu Name="menu1" MinWidth="500" Grid.Row="0"/>
<Image Name="image1" Grid.Row="1" RenderTransform="{DynamicResource InitialMatrixTransform}"
IsManipulationEnabled="True" Source="/multi_touch;component/Images/1.gif" Margin="107,54,296,114" ManipulationInertiaStarting="im_inertia_starting" ManipulationDelta="im_delta" ManipulationCompleted="im_completed" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Button Name="button1" Grid.Row="2" MinWidth="50" Content="下一幅" HorizontalAlignment="Right" Click="button1_Click" >
</Button>
<Button Name="button2" Grid.Row="2" MinWidth="50" Content="上一幅" HorizontalAlignment="Center" Click="button2_Click" />
</Grid> 展开
展开全部
你在前台image是放在哪个容器里面的?把xaml贴出来才能具体分析。
追问
就是在那个GRID里面,
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你设置的是image控件里面的东西居中,你设置一下这个控件外面的属性试试
追问
外面就是window和grid了,不会这样设啊
追答
去掉Margin="107,54,296,114"
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询