按钮应该贴上标签,主屏幕上应该有各种各样的文本块。
让事情变得更奇怪:
-
调试时。
-
时间。
-
托管浏览器。一些尺码,全部
(通过固定的布局转换,
有时短信也会丢失)。改为RenderTransform不会更改此行为。也不需要移除rezising。
-
在自定义控件中呈现。
-
这种行为只在某些计算机上出现。我怀疑他们都安装了.NET 4.0。在为.NET 4.0编译时,一切都很好,但是由于.net4.0尚未广泛安装,我宁愿为.NET 3.5编译
你知道是什么引起的吗?请询问您是否需要更多信息!谢谢!
编辑:
我做了一个小项目来重现这个错误。你会发现它已经出版了
here
从WPF浏览器应用程序开始,这是我在Page1.xaml中的代码
<Page x:Class="BugDemo.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Grid x:Name="LayoutRoot">
<TextBlock FontSize="35" Text="Vanishing Text" />
<Grid.LayoutTransform>
<ScaleTransform />
</Grid.LayoutTransform>
</Grid>
</Page>
代码隐藏:
public partial class Page1 : Page
{
public Page1()
{
InitializeComponent();
this.Loaded += AppPage_Loaded;
}
public double Scale
{
get { return ((ScaleTransform)this.LayoutRoot.LayoutTransform).ScaleX; }
set
{
((ScaleTransform)this.LayoutRoot.LayoutTransform).ScaleX = value;
((ScaleTransform)this.LayoutRoot.LayoutTransform).ScaleY = value;
}
}
void AppPage_Loaded(object sender, RoutedEventArgs e)
{
App.Current.MainWindow.SizeChanged += (o, args) => UpdateScale();
UpdateScale();
}
private void UpdateScale()
{
double xscale = (App.Current.MainWindow.ActualWidth) / 300;
double yscale = (App.Current.MainWindow.ActualHeight) / 200;
Scale = Math.Min(xscale, yscale);
}
}
发布后,“消失的文本”只能在某些缩放级别上看到。它在调试中运行良好。