用户控件的相对比例大小如图像(在图像编辑器中)。
示例(100%):
alt text http://stegnar.com/pic/normalPicture.png
缩小UC(70%):
alt text http://stegnar.com/pic/normalPicture70percent.png
我在图片编辑器中实现了这一点,但我想在WPF中。 :)我需要这个调整我的应用程序到不同的屏幕分辨率,而没有隐藏(没有滚动条)。
解决方法
您可以尝试放大/缩小其内容的ViewBox控件,以便填充可用空间。
- <Window x:Class="WpfApplication1.Window1"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:local="clr-namespace:WpfApplication1"
- Title="Window1">
- <Grid>
- <ViewBox StretchDirection="Both" Stretch="Uniform">
- <local:UserControl1 Height="600" Width="600"/>
- </ViewBox>
- </Grid>