WPF文本块扭曲文本

时间:2017-02-06 13:04:07

标签: wpf vb.net xaml

我在我的一台电脑上遇到了一个奇怪的问题。问题与如何在两台不同的计算机上呈现文本有关。

我将首先分享两个屏幕截图。一个是正​​确的版本,然后是有问题的版本。 enter image description here

enter image description here

在这里,你可以看到后面的截图中的文字失真。

以下是XAML。章节" CountdownView"和#34; MessageView"是可见的,"响应指标"隐藏在两种情况下。 Verdana Font绑定到两个文本块。

        <!--PollingInfoView-->
    <Grid 
        x:Name="PollingInfoView"
        Width="auto" Height="auto" 
        Visibility="Collapsed"
        VerticalAlignment="Top"

        >
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.2*"></ColumnDefinition>
            <ColumnDefinition Width="0.67*"></ColumnDefinition>
            <ColumnDefinition Width="0.15*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <Grid.Background>
            <SolidColorBrush
                    Color="{Binding Path=PollingInfoBackgroundColor, Mode=OneWay}"
                    Opacity="{Binding Path=PollingInfoBackgroundOpacity, Mode=OneWay}"
                >

            </SolidColorBrush>
        </Grid.Background>



        <!--CountdownView-->
        <Grid Width="auto" Height="auto" >

            <Viewbox Stretch="Uniform" Width="auto" Height="auto" >

                <Border x:Name="ResponsiveIndicator" Visibility="Hidden" Background="DarkRed"  Margin="5,0,0,0">
                    <TextBlock x:Name="tbResponseIndicatorText" VerticalAlignment="Center" HorizontalAlignment="Center" 
                               Foreground="{Binding Path=PollingInfoForegroundColor, Mode=OneWay}" 
                               Width="auto" Height="auto" 
                               Margin="0,3,0,3"
                               FontFamily="{Binding Path=PollingInfoFontFamily, Mode=OneWay}" FontSize="12"                                    
                               >
                        <TextBlock.Effect>
                            <DropShadowEffect Color="{Binding Path=DropShadowColor, Mode=OneWay}"
                                              Opacity="{Binding Path=DropShadowOpacity, Mode=OneWay}"
                                              BlurRadius="{Binding Path=DropShadowBlurRadius, Mode=OneWay}"
                                              Direction="240"
                                              ShadowDepth="{Binding Path=DropShadowDepth, Mode=OneWay}"
                                              >

                            </DropShadowEffect>

                        </TextBlock.Effect>



                    </TextBlock>
                </Border>

            </Viewbox>

        </Grid>
        <!--MessageView-->
        <Border Grid.Column="1" Width="auto" Height="auto" >
            <Viewbox Stretch="Uniform" Width="auto" Height="auto" >
                <Grid 
                    Width="auto" Height="auto" 
                    x:Name="MessageView">
                    <TextBlock Name="tbMessage" 
                               TextAlignment="Center" 
                               HorizontalAlignment="Center" 
                               Foreground="{Binding Path=PollingInfoForegroundColor, Mode=OneWay}" 
                               FontSize="32"          
                               Width="auto" Height="auto" 
                               FontFamily="{Binding Path=PollingInfoFontFamily, Mode=OneWay}" 
                               Text="Please Vote Now"
                               >
                        <TextBlock.Effect>
                            <DropShadowEffect Color="{Binding Path=DropShadowColor, Mode=OneWay}"
                                              Opacity="{Binding Path=DropShadowOpacity, Mode=OneWay}"
                                              BlurRadius="{Binding Path=DropShadowBlurRadius, Mode=OneWay}"
                                              Direction="240"
                                              ShadowDepth="{Binding Path=DropShadowDepth, Mode=OneWay}"
                                              >

                            </DropShadowEffect>

                        </TextBlock.Effect>

                    </TextBlock>
                </Grid>
            </Viewbox>
        </Border>

        <!--Response Indicator-->
        <Border Grid.Column="2" Width="auto" Height="auto" >
            <Viewbox Stretch="Uniform" Width="auto" Height="auto" >
                <Grid 
            x:Name="CountdownView"
                    Width="auto" Height="auto" 
            HorizontalAlignment="Right">
                    <TextBlock Name="tbCountDown" Visibility="Hidden" TextAlignment="Center" HorizontalAlignment="Center"                                    
                               Foreground="{Binding Path=PollingInfoForegroundColor, Mode=OneWay}" 
                               FontSize="32"
                               FontFamily="{Binding Path=PollingInfoFontFamily, Mode=OneWay}" 
                               Width="auto" Height="auto" 
                               Text="5"
                               >
                        <TextBlock.Effect>
                            <DropShadowEffect Color="{Binding Path=DropShadowColor, Mode=OneWay}"
                                              Opacity="{Binding Path=DropShadowOpacity, Mode=OneWay}"
                                              BlurRadius="{Binding Path=DropShadowBlurRadius, Mode=OneWay}"
                                              Direction="240"
                                              ShadowDepth="{Binding Path=DropShadowDepth, Mode=OneWay}"
                                              >

                            </DropShadowEffect>

                        </TextBlock.Effect>
                    </TextBlock>
                </Grid>
            </Viewbox>
        </Border>
    </Grid>

注意:有问题的电脑的屏幕分辨率为:1366x768。它是带有&#34;英特尔(R)HD图形系列的Windows 7企业版&#34;显示适配器。虽然我无法在另一台分辨率为1366x768的计算机上重现此问题,但该计算机安装了不同的显示驱动程序。

任何解决方案,想法或暗示都将非常感激。感谢。

0 个答案:

没有答案