wpf – 用户控件的相对比例大小?

前端之家收集整理的这篇文章主要介绍了wpf – 用户控件的相对比例大小?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
用户控件的相对比例大小如图像(在图像编辑器中)。

示例(100%):

alt text http://stegnar.com/pic/normalPicture.png

缩小UC(70%):

alt text http://stegnar.com/pic/normalPicture70percent.png

我在图片编辑器中实现了这一点,但我想在WPF中。 :)我需要这个调整我的应用程序到不同的屏幕分辨率,而没有隐藏(没有滚动条)。

解决方法

您可以尝试放大/缩小其内容的ViewBox控件,以便填充可用空间。
  1. <Window x:Class="WpfApplication1.Window1"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:local="clr-namespace:WpfApplication1"
  5. Title="Window1">
  6. <Grid>
  7. <ViewBox StretchDirection="Both" Stretch="Uniform">
  8. <local:UserControl1 Height="600" Width="600"/>
  9. </ViewBox>
  10. </Grid>

猜你在找的CSS相关文章