2

I am using TextBlock control. Text in the TextBlock is clearly displayed with 0 degree rotation.

But if i rotated the control to 90 degree using LayoutTransform, text is not clear. some blurry display.

Is there anyother way to rotate the text without LayoutTransform or anyother way for clear display?

Lakshmanan
  • 21
  • 3

3 Answers3

3

try using "UseLayoutRounding=true" on your TextBox

David
  • 6,014
  • 4
  • 39
  • 55
0

I know this is an old question, however, I had the same problem with a user control which had SnapsToDevicePixels="True" and UseLayoutRounding="True" with the code below the first label showed a blurred box, while the non-transformed one showed the text perfectly. I tried flowing up the snaps and rounding properties up to the hierarchy and in the end, the only thing that fixed this behavior was to apply UseLayoutRounding=" True" to the window. Applying it to any other children panel or user-control did not fix it.

    <UserControl x:Class="MyApp.Controls.Indications"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300"
         SnapsToDevicePixels="True"
         UseLayoutRounding="True">
    <Stackpanel>

    <Label
        BorderBrush="Black"
        BorderThickness="1"
        HorizontalAlignment="Center">

        <TextBlock
            Width="100"
            TextAlignment="Center"
            Text="Left Outboard Actuator"
            TextWrapping="Wrap">

            <TextBlock.LayoutTransform>
                <RotateTransform

                    Angle="90"/>
            </TextBlock.LayoutTransform>

        </TextBlock>

    </Label>

    <Label
        BorderBrush="Black"
        BorderThickness="1"
        HorizontalAlignment="Center">

        <TextBlock
            Width="100"
            TextAlignment="Center"
            Text="Left Outboard Actuator"
            TextWrapping="Wrap">

        </TextBlock>

    </Label>

    </Stackpanel>
</UserControl>
GYaN
  • 2,327
  • 4
  • 19
  • 39
user1464603
  • 437
  • 4
  • 8
0

Set TextBlock's Foreground property a value(like Black) will be clear. it's worked on my project when I rotate textblock 90 degree.