2011-03-25 48 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