locked
One pixel render artefact on scaled content RRS feed

  • Question

  • Hi,

    I've encountered with the following problem:

    For example, there is following content in ScrollViewer:

    <ScrollViewer >
       <Grid Width="255" Height="255">
          <Border Background="Cyan"/>
          <Border Background="Black" />
       </Grid>
    </ScrollViewer>

     

    When ScrollViewer.ZoomFactor is not integer value, we can see one pixel line of underlying content (Cyan border instead of Black in example).

    Sample - VS2013, Win 8.1 x64

    Is there any way to render content correctly?

    Wednesday, January 29, 2014 11:05 AM

Answers

  • Hi Mikhail,

    Thanks for your code and I can reproduce the issue that you are facing. A strange dark green line appears while ZoomFactor is not 1, not only 0.9, but also when the value is 1.1, the same thing happens.

    However I don't think the issue locates on ScrollViewer, it might be a ScaleTransform issue, if we have following code, scale the gird without the help of ScrollViewer, we shall see the dark green line either(the fourth Gird sample in your project). ScrollViewer is only applying the ScaleTransform for Gird inside it.

            <StackPanel Grid.Column="1" Grid.Row="1">
                <Grid Width="255" Height="255">
                    <Grid.RenderTransform>
                        <ScaleTransform ScaleX="1.1" ScaleY="1.1"/>
                    </Grid.RenderTransform>
                    <Border Background="Cyan"/>
                    <Border Background="Black"/>
                </Grid>
                <TextBlock Text="ScaleTransform.Scale == 0.9"/>
            </StackPanel>

    Currently I don't have any solution for how to remove the dark line offhand. But I will try to report this issue as a bug to some senior engineers, thank you for submit this.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Thursday, January 30, 2014 2:22 AM
    Moderator