本文介绍了按钮变成无形的Windows 7计算机没有安装Visual Studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个显示我们所有与Visual Studio的Windows 7开发的机器,但是不能在那些不精安装Visual Studio的窗口。我们有一个简单的确定/取消按钮对和受影响的机器的确定按钮是不可见的,但如果你的地方在哪里单击它应该是它仍然有效。

We have a window that displays fine on all of our Windows 7 development machines with Visual Studio but not on the ones without Visual Studio installed. We have a simple OK/Cancel button pair and on the affected machines the OK button is invisible but if you click in the place where it should be it still works.

下面是使用的样式:

<Style x:Key="OptionsOkButton" TargetType="{x:Type Button}">
    <Setter Property="HorizontalAlignment" Value="Right" />
    <Setter Property="Width" Value="100" />
    <Setter Property="Height" Value="30" />
    <Setter Property="FontSize" Value="14" />
    <Setter Property="Margin" Value="5" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Effect">
        <Setter.Value>
            <DropShadowEffect ShadowDepth="3" Opacity="0.7" />
        </Setter.Value>
    </Setter>
</Style>

<Style x:Key="OptionsCancelButton" TargetType="{x:Type Button}">
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="Width" Value="100" />
    <Setter Property="Height" Value="30" />
    <Setter Property="FontSize" Value="14" />
    <Setter Property="Margin" Value="5" />
    <Setter Property="SnapsToDevicePixels" Value="True" />
    <Setter Property="Effect">
        <Setter.Value>
            <DropShadowEffect ShadowDepth="3" Opacity="0.7" />
        </Setter.Value>
    </Setter>
</Style>

这里是code的按键:

And here is the code for the buttons:

<Grid Name="grdFooter" DockPanel.Dock="Bottom">
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Button Grid.Column="0" Content="OK" Style="{StaticResource OptionsOkButton}" Click="btnOK_click"/>
    <Button Grid.Column="1" Content="Cancel" Style="{StaticResource OptionsCancelButton}" Click="btnCancel_Click"  />
</Grid>

这似乎是上的使用这些风格(约5不同的窗口)每个按钮对发生的事情。有没有人有什么可能导致它的任何意见或建议?

It seems to be happening on every button pair that's using these styles (around 5 different windows). Does anyone have any ideas or suggestions on what might be causing it?

编辑:我要清楚,一切都工作得很好,甚至在Windows XP和Vista的全新安装。这似乎仅限于Windows 7和都出现在从Vista全新安装和升级(适用于Vista的罚款,升级按钮消失)。

I should make it clear that everything works just fine even on fresh installs of Windows XP and Vista. It appears to be limited to Windows 7 and appears both on fresh installs and upgrades from Vista (works fine on Vista, upgrade, button disappears).

编辑2:我也应该清楚,只有OK按钮变成无形的,取消按钮仍然会出现正常

Edit 2: I should also make clear that only the OK button turns invisible, the Cancel button will still appear normally.

推荐答案

据的, DropShadowEffect 仅支持在.net 3.5 SP1。我猜这是安装在您的Visual Studio的机器,那别人有框架的旧版本。

According to this MSDN entry, DropShadowEffect is only supported in .NET 3.5 SP1. I'd guess this is installed on your Visual Studio machines, and that the others have an older version of the framework.

这篇关于按钮变成无形的Windows 7计算机没有安装Visual Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 19:19