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.
Here are the styles used:
<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>
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>
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?
Edit: 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, butt开发者_高级运维on disappears).
Edit 2: I should also make clear that only the OK button turns invisible, the Cancel button will still appear normally.
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.
精彩评论