Text shadow

How can I add shadow for a richtextbox text without using BitmapEfects?

Thanks

[143 byte] By [CornelGav] at [2008-1-9]
# 1

Here's a start:

Code Snippet

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">


<StackPanel Margin="50">

<!-- The object to reflect. -->
<RichTextBox Name="rtb" Width="400">
<FlowDocument>
<Paragraph> Some Text </Paragraph>
</FlowDocument>
</RichTextBox>

<Rectangle Height="1" Fill="Gray" HorizontalAlignment="Stretch" />

<!-- The object to contain the reflection.-->
<Rectangle
Height="{Binding Path=ActualHeight, ElementName=rtb}"
Width="{Binding Path=ActualWidth, ElementName=rtb}">
<Rectangle.Fill>

<!-- Creates the reflection. -->
<VisualBrush
Opacity="0.75" Stretch="None"
Visual="{Binding ElementName=rtb}">
<VisualBrush.RelativeTransform>

<!-- Flip the reflection. -->
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="-1" />
<TranslateTransform Y="1" />
<SkewTransform AngleX="3" />
</TransformGroup>
</VisualBrush.RelativeTransform>
</VisualBrush>
</Rectangle.Fill>


</Rectangle>
</StackPanel>

</Canvas>

SteveGalic-MSFT at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 2
I meant to say text shadow, not richtextbox shadow Sad
CornelGav at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...
# 3

Hi Cornel

Do you mean you want to create the text shadow but not text box shadow without using BitmapEffects? If so, you can create two text to simulate the shadow. For example:

Code Snippet

<RichTextBox Name="rtb" Width="400">

<FlowDocument>

<BlockUIContainer>

<Grid>

<TextBlock Foreground="Black" Text="Shadow Text">

<TextBlock.RenderTransform>

<TranslateTransform X="3" Y="3"/>

</TextBlock.RenderTransform>

</TextBlock>

<TextBlock Foreground="Coral" Text="Shadow Text"/>

</Grid>

</BlockUIContainer>

</FlowDocument>

</RichTextBox>

Best Regards

Wei Zhou

WeiZhou-MSFT at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Windows Presentation Foundation (WPF)...

Visual Studio Orcas

Site Classified