Silverlight中沿曲率路径的文本,如圆形或圆弧 [英] text along curvature path like circular or arc in silverlight

查看:17
本文介绍了Silverlight中沿曲率路径的文本,如圆形或圆弧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Silverlight 4.0设计一个图像编辑器

正在查找沿曲率路径键入的文本,如圆形或圆弧

类似Photoshop中提供的内容http://youtu.be/6L6qAKkBQxc

这上面有可用的代码段吗?

谢谢

推荐答案

此处需要PathListBox(来自Microsoft.Expression.Controls)。

基本上只需要创建一个Path并将其转换为PathListBox,然后将TextBlockText属性绑定到PathListBoxItemsSource

类似于此。

xmlns:ec="http://schemas.microsoft.com/expression/2010/controls"

<Grid x:Name="LayoutRoot" Background="White">
    <ec:PathListBox Height="135" Margin="143.5,73.5,224.5,0" VerticalAlignment="Top" ItemsSource="{Binding Text, ElementName=textBlock}">
        <ec:PathListBox.ItemTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding}" FontWeight="Bold" FontSize="18.667" />
            </DataTemplate>
        </ec:PathListBox.ItemTemplate>
        <ec:PathListBox.LayoutPaths>
            <ec:LayoutPath SourceElement="{Binding ElementName=path}" Orientation="OrientToPath" Padding="-10"/>
        </ec:PathListBox.LayoutPaths>
    </ec:PathListBox>
    <Path x:Name="path" Data="M144,203 C144,203 165,74 273,74 C381,74 415,208 415,208" Height="135" Margin="143.5,73.5,224.5,0" Stretch="Fill" UseLayoutRounding="False" VerticalAlignment="Top"/>
    <TextBlock x:Name="textBlock" HorizontalAlignment="Left" TextWrapping="Wrap" Text="this is a test, test..." VerticalAlignment="Top" Margin="22,19,0,0" Visibility="Collapsed"/>
</Grid>

另外,您可能希望覆盖PathListBoxItemContainerStyle,这样每个字母都不可选。

希望这能有所帮助。:)

这篇关于Silverlight中沿曲率路径的文本,如圆形或圆弧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆