在XP中将鼠标悬停在MenuItem上为蓝色,在Windows 7中可以使用 [英] MenuItem blue on hover in xp, fine in windows 7

查看:82
本文介绍了在XP中将鼠标悬停在MenuItem上为蓝色,在Windows 7中可以使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用XAML,我们在应用程序的右下方创建了一系列按钮.它们在DockPanel中,而DockPanel在网格中.它们仅用作切换按钮,单击后将更改为其他图像.当您将鼠标悬停在XP中的按钮上时,就会发生问题,该按钮完全变成蓝色,您看不到图像...只是蓝色.这在赢7中效果很好...

Using XAML we've created a series of buttons at the bottom right of our application. They are in a DockPanel, which is in a Grid. They're just used as toggles, when clicked it changes to the other image. The problem occurs when you hover over the button in XP, the button completely turns to blue, you can't see the image...just blue. This works fine in win 7...

<MenuItem Name="PhonePad_MenuItem" Background="{DynamicResource Audio_Btn_Dialer_Disabled_Brush}" Height="22" Width="22" Click="PhonePad_MenuItem_Click"  Margin="0,1,0,0" IsEnabled="False" ToolTip=""/>

要注意的一件事是,我们在同一DockPanel中有另一个按钮,该按钮本身具有在单击时填充的菜单项,在xp和7上都悬停时效果很好...这是代码:

One thing to note is that we have another button in the same DockPanel, which itself has menu items which are populated when clicked, works fine when hovered on both xp and 7...here's the code:

<MenuItem Name="Settings_MenuItem" Height="20" Width="Auto" IsEnabled="False" SubmenuOpened="Settings_MenuItem_SubmenuOpened" ToolTip="">
    <MenuItem.Header>
        <DockPanel Height="Auto" Width="Auto">
            <Image Name="Settings_MenuItem_Back" Source="{DynamicResource Audio_Btn_Device_Settings_Disabled}" Height="22" Width="22" HorizontalAlignment="Center" VerticalAlignment="Center" IsHitTestVisible="True" />
        </DockPanel>
    </MenuItem.Header>
    <MenuItem Header="" />
</MenuItem>

我尝试将SystemColors.HighlightBrushKey设置为透明,但这只会使图像完全消失.

I tried setting the SystemColors.HighlightBrushKey to transparent but that just makes the image disappear altogether.

有什么想法为什么不能在XP上使用但在7上可以使用?

Any ideas why this wouldn't work on XP but is fine on 7?

推荐答案

此行为与Win7和XP上的不同样式相关. 作为解决方案,您需要添加Aero样式.

This behavior is associated with different styles on Win7 and XP. As a solution, you need to add Aero styles.

<ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml"

这篇关于在XP中将鼠标悬停在MenuItem上为蓝色,在Windows 7中可以使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆