2011-03-25 103 views
0

WPF应用程序,使用Window对话框输入PIN。通常情况下,它看起来像这样:https://picasaweb.google.com/lh/photo/Xl-X6Lxf9QMYSHimMY7gAA?feat=directlinkWPF窗口内容随机分解

在Windows XP自助服务终端上,窗口随机分开。没有确切的方法来重现它,但疯狂地点击会迟早会出现。 https://picasaweb.google.com/lh/photo/-jpkc8_CBKycdASWW4fbyQ?feat=directlink并不总是完全像照片一样,但是也有类似的方式。看起来控件没有正确定位。

盒子是Wincor Nixdorf触摸屏亭,使用WinXP SP3,Fx 3.5 SP1。窗口标记是这样的:

<Window 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
xmlns:loc="clr-namespace:Company.Product.Common.Localization;assembly=Company.Product.Common" 
xmlns:locSecurity="clr-namespace:Company.Product.Common.Localization.Security;assembly=Company.Product.Common" 
x:Class="Company.Product.Modules.Security.PassPhraseEntryDialog" 
x:Name="Window" 
Title="{x:Static locSecurity:PassPhraseEntryDialog.Window_Title}" 
Width="224" Height="141" mc:Ignorable="d" 
WindowStartupLocation="CenterOwner" 
WindowStyle="ToolWindow" 
ResizeMode="NoResize" 
Loaded="Window_Loaded"> 

<Window.Resources> 
    <ResourceDictionary> 

     <ResourceDictionary.MergedDictionaries> 
      <ResourceDictionary Source="..\ResourceDictionaries\Styles.xaml"/> 
     </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 
</Window.Resources> 

<Canvas x:Name="LayoutRoot"> 
    <Label Content="{x:Static locSecurity:PassPhraseEntryDialog.Password_Label}" Canvas.Left="8" Canvas.Top="8" Width="72" Height="27"/> 
    <PasswordBox x:Name="passwordBox" Canvas.Left="77" Canvas.Top="8" Width="118" Height="27"/> 
    <Button x:Name="okButton" Width="75" Content="{x:Static loc:Common.Ok}" Canvas.Left="8" Canvas.Top="73." Click="OkButton_Click" IsDefault="True"/> 
    <Button x:Name="cancelButton" Width="75" Content="{x:Static loc:Common.Cancel}" Canvas.Left="125" Canvas.Top="73" IsCancel="True" /> 
    <TextBlock x:Name="errorMessage" Width="192" Height="19" Canvas.Left="8" Canvas.Top="37" TextWrapping="Wrap" Foreground="Red"> 
     <TextBlock.Background> 
      <SolidColorBrush/> 
     </TextBlock.Background> 
    </TextBlock> 
    <TextBlock Text="{x:Static loc:Common.ChangePin}" Style="{Binding Source={StaticResource LinkTextStyle}}" HorizontalAlignment="Right" Canvas.Top="41" Canvas.Left="8" Margin="0,10,10,5" Cursor="Hand" x:Name="txtChangePin" MouseLeftButtonUp="txtChangePin_MouseLeftButtonUp" /> 

</Canvas> 

任何提示或想法都非常欢迎。

+0

对不起,两幅图像都是一样的。什么,“分崩离析”是什么意思? – Will 2011-03-25 14:29:57

+0

修,谢谢。查看第二个链接,查看崩溃的例子。 – 2011-03-25 14:31:36

回答

1

我不确切地知道原因是什么,但我强烈怀疑这与此有关渲染硬件。

我会尝试更改目标机器上的WPF应用程序的呈现设置。 See this link获取相关的注册表设置。

+0

禁用硬件加速似乎解决了这个问题。我发现了一种方法来禁止HW加速编程,只为这个窗口。请参阅:http://blogs.microsoft.co.il/blogs/janiv/archive/2009/06/07/hardware-acceleration-in-wpf.aspx非常感谢这个想法! – 2011-03-25 17:28:02

+0

@Dercsár:另外,看看你是否可以更新图形驱动程序。可以帮助。 – Will 2011-03-25 17:49:29

1

您是否尝试过为画布指定高度/宽度?我不相信画布会自动调整尺寸以填充可用空间,也许这在渲染时引起混淆

+0

会试一试,但画布/窗口大小没有问题。麻烦在于画布内。 – 2011-03-25 15:45:25

+0

没有帮助。无论如何,小费是小费。 – 2011-03-25 16:31:32