Skip to content

Commit

Permalink
Merge pull request #1537 from MahApps/1536-punker76-ClearType-stuff
Browse files Browse the repository at this point in the history
[RFC] clear type stuff
  • Loading branch information
punker76 committed Sep 4, 2014
2 parents 2ef6bb8 + fc4281b commit ef53561
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 13 deletions.
17 changes: 15 additions & 2 deletions MahApps.Metro/Microsoft.Windows.Shell/WindowChromeWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,15 +1125,28 @@ private void _ExtendGlassFrame()
// Ensure standard HWND background painting when DWM isn't enabled.
if (!NativeMethods.DwmIsCompositionEnabled())
{
_hwndSource.CompositionTarget.BackgroundColor = SystemColors.WindowColor;
// Apply the transparent background to the HWND for disabled DwmIsComposition too
// but only if the window has the flag AllowsTransparency turned on
if (_window.AllowsTransparency)
{
_hwndSource.CompositionTarget.BackgroundColor = Colors.Transparent;
}
else
{
_hwndSource.CompositionTarget.BackgroundColor = SystemColors.WindowColor;
}
}
else
{
// This makes the glass visible at a Win32 level so long as nothing else is covering it.
// The Window's Background needs to be changed independent of this.

// Apply the transparent background to the HWND
_hwndSource.CompositionTarget.BackgroundColor = Colors.Transparent;
// but only if the window has the flag AllowsTransparency turned on
if (_window.AllowsTransparency)
{
_hwndSource.CompositionTarget.BackgroundColor = Colors.Transparent;
}

// Thickness is going to be DIPs, need to convert to system coordinates.
Thickness deviceGlassThickness = DpiHelper.LogicalThicknessToDevice(_chromeInfo.GlassFrameThickness);
Expand Down
1 change: 1 addition & 0 deletions MahApps.Metro/Styles/Accents/BaseDark.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<SolidColorBrush x:Key="MenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="ContextMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="SubMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="MenuItemBackgroundBrush" Color="{StaticResource WhiteColor}" />

<SolidColorBrush x:Key="ContextMenuBorderBrush" Color="{StaticResource BlackColor}" />
<SolidColorBrush x:Key="SubMenuBorderBrush" Color="{StaticResource BlackColor}" />
Expand Down
1 change: 1 addition & 0 deletions MahApps.Metro/Styles/Accents/BaseLight.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<SolidColorBrush x:Key="MenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="ContextMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="SubMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="MenuItemBackgroundBrush" Color="{StaticResource WhiteColor}" />

<SolidColorBrush x:Key="ContextMenuBorderBrush" Color="{StaticResource BlackColor}" />
<SolidColorBrush x:Key="SubMenuBorderBrush" Color="{StaticResource BlackColor}" />
Expand Down
1 change: 1 addition & 0 deletions MahApps.Metro/Styles/Colors.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<SolidColorBrush x:Key="MenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="ContextMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="SubMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="MenuItemBackgroundBrush" Color="{StaticResource WhiteColor}" />

<SolidColorBrush x:Key="ContextMenuBorderBrush" Color="{StaticResource BlackColor}" />
<SolidColorBrush x:Key="SubMenuBorderBrush" Color="{StaticResource BlackColor}" />
Expand Down
24 changes: 14 additions & 10 deletions MahApps.Metro/Styles/Controls.ComboBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,28 +290,30 @@
Opacity="0" />
<!-- AllowsTransparency="true" fixes the redraw problem under windows vista/7 with a selected non aero theme -->
<Popup x:Name="PART_Popup"
AllowsTransparency="true"
AllowsTransparency="True"
Focusable="False"
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"
MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{Binding MaxDropDownHeight, RelativeSource={RelativeSource TemplatedParent}}"
Placement="Bottom">
<Border x:Name="PopupBorder"
Effect="{DynamicResource DropShadowBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalAlignment="Stretch"
Height="Auto"
BorderBrush="{DynamicResource ComboBoxPopupBrush}"
Background="{DynamicResource WhiteBrush}">
<Grid>
<Border x:Name="PopupBorder"
Effect="{DynamicResource DropShadowBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalAlignment="Stretch"
Height="Auto"
BorderBrush="{DynamicResource ComboBoxPopupBrush}"
Background="{DynamicResource WhiteBrush}">
</Border>
<ScrollViewer x:Name="DropDownScrollViewer"
BorderThickness="0"
Margin="2"
Padding="1">
<ItemsPresenter x:Name="ItemsPresenter"
KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Border>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
Expand Down Expand Up @@ -381,8 +383,10 @@
Value="Left" />
<Setter Property="VerticalContentAlignment"
Value="Top" />
<Setter Property="RenderOptions.ClearTypeHint"
Value="Enabled" />
<Setter Property="Background"
Value="{DynamicResource TransparentWhiteBrush}" />
Value="{DynamicResource WhiteBrush}" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="Template">
Expand Down
4 changes: 3 additions & 1 deletion MahApps.Metro/Styles/Controls.ContextMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@
Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="VerticalContentAlignment"
Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="RenderOptions.ClearTypeHint"
Value="Enabled" />
<Setter Property="Background"
Value="Transparent" />
Value="{DynamicResource MenuItemBackgroundBrush}" />
<Setter Property="ScrollViewer.PanningMode"
Value="Both" />
<Setter Property="Stylus.IsFlicksEnabled"
Expand Down

0 comments on commit ef53561

Please sign in to comment.