spring mvc 为什么使用接口,然后写个实现类的方式
1个回答
展开全部
spring mvc 为什么使用接口,然后写个实现类的方式
<Canvas x:Name="canvas1" SizeChanged="canvas1_SizeChanged" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Red">
<Canvas Width="200" Height="200" x:Name="canvas2" Background="Black" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Canvas>
private void canvas1_SizeChanged(object sender, SizeChangedEventArgs e)
{
canvas2.SetValue(Canvas.LeftProperty, (canvas1.ActualWidth - canvas2.ActualWidth) / 2);
canvas2.SetValue(Canvas.TopProperty, (canvas1.ActualHeight - canvas2.ActualHeight) / 2);
}
<Canvas x:Name="canvas1" SizeChanged="canvas1_SizeChanged" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Red">
<Canvas Width="200" Height="200" x:Name="canvas2" Background="Black" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Canvas>
private void canvas1_SizeChanged(object sender, SizeChangedEventArgs e)
{
canvas2.SetValue(Canvas.LeftProperty, (canvas1.ActualWidth - canvas2.ActualWidth) / 2);
canvas2.SetValue(Canvas.TopProperty, (canvas1.ActualHeight - canvas2.ActualHeight) / 2);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询