Outlined Text
In WPF, we can create a custom TextBlock control that draws outlined texts:
https://stackoverflow.com/a/9887123/1767995
Is it possible to do this using NoesisGUI ? In the example above, FormattedText class is used to generate the geometry of the string, given the font size, rectangle to draw, and other properties. Then the geometry is drawn with different fill color and stroke color.
Is it possible to achieve the same effect using NoesisGUI ?
thanks.
https://stackoverflow.com/a/9887123/1767995
Is it possible to do this using NoesisGUI ? In the example above, FormattedText class is used to generate the geometry of the string, given the font size, rectangle to draw, and other properties. Then the geometry is drawn with different fill color and stroke color.
Is it possible to achieve the same effect using NoesisGUI ?
thanks.
- ai_enabled
- Posts: 231
- Joined:
- Contact:
Re: Outlined Text
There is a special feature in NoesisGUI - two attached properties Text.Stroke and Text.StrokeThickness https://www.noesisengine.com/docs/Gui.C ... orial.html (section "Text color properties").
Of course, there are no such properties in WPF so if you want your XAML code to compile with these properties in WPF project, you need to add this file into your WPF project https://github.com/Noesis/noesisgui-con ... nd/Text.cs
But NoesisGUI already knows about these properties and will properly draw the stroke around your text.
Of course, there are no such properties in WPF so if you want your XAML code to compile with these properties in WPF project, you need to add this file into your WPF project https://github.com/Noesis/noesisgui-con ... nd/Text.cs
But NoesisGUI already knows about these properties and will properly draw the stroke around your text.
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
Re: Outlined Text
Exactly, thanks ai_enabled, something like this will work in Noesis:
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:noesis="clr-namespace:NoesisGUIExtensions">
<StackPanel VerticalAlignment="Center" Width="200" TextElement.FontSize="25">
<TextBlock Text="Stroke" TextAlignment="Center" Margin="4" noesis:Text.Stroke="DodgerBlue" noesis:Text.StrokeThickness="2.5"/>
</StackPanel>
</Grid>
Re: Outlined Text
You welcome! Marking as solved.
Re: Outlined Text
And what should I do to make the stroke feature work but not in a CSharp project? What to do to make Blend recognize the syntax while the actual thing is rendered in a C++ app?
-
sfernandez
Site Admin
- Posts: 3008
- Joined:
Re: Outlined Text
You can include in your Blend project NoesisGUIExtensions.cs file:
https://github.com/Noesis/Tutorials/blo ... ensions.cs
Then you will be able to use Noesis Text extension properties in Blend (although nothing will be rendered there) and compile everything fine.
https://github.com/Noesis/Tutorials/blo ... ensions.cs
Then you will be able to use Noesis Text extension properties in Blend (although nothing will be rendered there) and compile everything fine.
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:noesis="clr-namespace:NoesisGUIExtensions">
<TextBlock noesis:Text.Stroke="Red" noesis:Text.StrokeThickness="1" Text="Hello"/>
</Grid>
Re: Outlined Text
Thanks for the feedback!
Re: Outlined Text
Is there a way to set stroke and stroke thickness via a style?
Who is online
Users browsing this forum: Semrush [Bot] and 6 guests