弧段上的弯曲,居中文本 [英] Curved, Centred Text On an Arc Segment

查看:87
本文介绍了弧段上的弯曲,居中文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了一个小型的WPF项目。我以前从未对WPF或XAML做过任何事情,但它看起来相对简单。我被要求评估一些变化的可行性。



目前我们有一个带轮辐的轮子。辐条标记当前在车轮外部伸出,水平书写,但处于辐条角度(基本上,标签看起来像辐条的延伸)。我被问到是否可以改变它以在轮子周围的弧形带中显示辐条标签(彩色圆弧上的标签,以每个辐条为中心)。

(文本是半动态,从数据文件中读取!)



看到这个:



WPF路径上的文字 [ ^ ]



和这个:



ArcSegment [ ^ ]



看起来这不会'太难实现,但我不知道技术性。



怎么样arcedtex的自动换行T'那么水平和垂直居中呢?如何计算文本大小,以便我可以更改字体大小,如果它不适合?如何以及何时翻转圆弧上的文字以便它主要是正确的方式?这些是我可以预见的必须处理的一些细节,但不知道它们是多么可行/容易/可能。



这种变化是否比听起来更难?

I've inherited a small WPF project. I've never done anything with WPF or XAML before, but it looks relatively straightforward. I've been asked to evaluate the feasibility of some changes.

Currently we have a wheel, with spokes. The spoke labels current 'stick out' outside the wheel, written horizontally, but at the 'spoke angle' (essentially, the labels look like extensions of the spoke). I've been asked if we can change this to display the spoke label in an arc-ing band around the wheel (the label on a coloured arc, centred on each spoke).
(the text is semi-dynamic, read from a data file!)

Seeing this:

Text On A Path in WPF[^]

and this:

ArcSegment[^]

It seems like this wouldn't be too difficult to achieve, but I have no idea about the technicalities.

What about word-wrapping of "arced" text? What about centring horizontally and vertically? What about calculating the text size so I can change the font size if it doesn't fit? How and when to flip the text on the arc so it is mostly the right way up? These are some of the details I can anticipate having to deal with, but have no idea how workable / easy / possible they are.

Is this change harder than it sounds?

推荐答案

参见 WPF中的路径上的文本 [ ^ ]对我的解决方案的评论。
See Text On A Path in WPF[^] comments for my solution.


这篇关于弧段上的弯曲,居中文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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