Today's post talked about SnapsToDevicePixels and there were some bits I neglected to mention.
Inheritence
Yes, SnapsToDevicePixels is inherited by the subordinate elements in the Visual Tree. For example. Here is a Border which contains a Rectangle. The border is positioned at 20.5, 20.5 again.

Here are the same elements with SnapsToDevicePixels set to True on the inner Rectangle.

... and again but this time with SnapsToDevicePixels set to true on the outer Border and not specified on the inner Rectangle.

Here's the Xaml used in the final example.
<Border Canvas.Top="20.5" Canvas.Left="20.5" Width="30" Height="30" BorderThickness="1" BorderBrush="Black" CornerRadius="10,0,10,0" SnapsToDevicePixels="True">
<Rectangle Width="10" Height="10" Stroke="Red" />
</Border>

Post By
Josh Twist
4:47 AM
24 Jul 2007
» Next Post:
Tonight PowerShell saved my music library
« Previous Post:
Infinite Resolution and SnapsToDevicePixels
Comments are closed for this post.
Posted by
Armin
@
03 Mar 2010
3:11 AM
Hello Josh,
i had a problem probaly with SnapsToDevicePixels.
I want drawing a black line with 1 pixel thickness is OnRender Method.
But always it is 2 pixel width and color is gray. I cannot find any solution.
Can you help me?
thanks
Armin