samedi 9 mai 2015

How to change the scaling algorithm that is applied to the icon in the window?

If large images are displayed in a size smaller than the original, then begin to show artifacts "pixelation":

http://ift.tt/1EVmo1E

But this can be solved by specifying the attribute of the object in XAML, scaling algorithm with higher quality:

<Image Height="50" Width="50" 
     Source="Resources/logo.png" 
     RenderOptions.BitmapScalingMode="HighQuality" /><!-- Scaling Mode -->

Then, the image looks fine:

http://ift.tt/1dSUvhW

Question. How to change the scaling algorithm that is applied to the icon in the window? Icon set through XAML (the last line):

<Window x:Class="MyApp.AboutWindow"
xmlns="http://ift.tt/1EVmqqp"
xmlns:x="http://ift.tt/mPTqtT"
xmlns:res="clr-namespace:MyApp.Properties"
Title="{x:Static res:Resources.AboutWindowTitle}" 
Height="450" Width="300" 
ResizeMode="NoResize" 
WindowStartupLocation="CenterOwner"
Icon="Resources/info.png"><!-- Icon -->

Icon in the title bar looks like this:

_https://habrastorage.org/files/946/bb7/67b/946bb767b66042aba985a8e55a21b078.png (Sorry, I do not have enough reputation to post third link)

Attribute RenderOptions.BitmapScalingMode = "HighQuality" applied to the window, gives nothing.

Aucun commentaire:

Enregistrer un commentaire