【问题标题】:Images are not sharp in selected TabItem所选 TabItem 中的图像不清晰
【发布时间】:2011-07-21 01:03:47
【问题描述】:

我有一个 TabControl。每个 TabItem 的标题都包含一个 StackPanel,带有一个图标和一个标签。

<TabControl>
  <TabItem>
    <TabItem.Header>
      <StackPanel Orientation="Horizontal">
        <Image Source="/LoginPanel;component/Icons/icoLogin.ico"</Image>
        <Label VerticalContentAlignment="Center">Login</Label>
        </StackPanel>
      </TabItem.Header>
    </TabItem.Header>
    <!--some further code here-->
  <TabItem>
  <!--some further code here-->
<TabControl>

每个未选中的 TabItem 中的每个图标都按预期显示。当前选中的 TabItem 中的 Icon 有点模糊。如果我切换到另一个选项卡,取消选择的选项卡图标变得清晰;新选择的图标变得模糊。

我已经尝试了以下方法来解决这个问题:

SnapsToDevicePixels="True"

但什么也没发生

Width="32" Height="32"

Stretch="None"

以防止缩放。 这一切都没有任何影响。有人可以给我一个提示吗?提前致谢

【问题讨论】:

    标签: wpf icons tabcontrol tabitem ico


    【解决方案1】:

    考虑将“RenderOptions.EdgeMode”也设置为“Aliased”。

    <Image Source="/LoginPanel;component/Icons/icoLogin.ico"
           RenderOptions.BitmapScalingMode="NearestNeighbor"
           RenderOptions.EdgeMode="Aliased"/> 
    

    请在此处查看Image in WPF getting blury

    【讨论】:

      【解决方案2】:

      这对我有用:

      <Image Source="/LoginPanel;component/Icons/icoLogin.ico"
             RenderOptions.BitmapScalingMode="NearestNeighbor"</Image>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-08-16
        • 2015-04-27
        • 2013-07-27
        相关资源
        最近更新 更多