White font with black border in XAML

匿名 (未验证) 提交于 2019-12-03 01:22:02

问题:

as the title says, I would like to have a black font with a white border in my TextBox.

How could it be achieved?

Cheers.

回答1:

Check out Blacklight controls @ http://blacklight.codeplex.com/. In particular look at the sample on http://mightymeaty.members.winisp.net/blacklight.silverlight/ | Visual Controls | TEXT | Stroke Text Block (Alpha).



回答2:

It's possible to convert text into geometry objects with advanced formatting like outlines and fills for individual letters - you can find out more about how to do that here.

Having said that, I'm not sure that this is possible inside a TextBox. It may be for read-only text (TextBlock) only.

Edit

This blog post shows some advanced font rendering techniques inside a TextBox. It may be handy for you.



回答3:

What I always do for that is set the font color to white and set a DropShadow effect on the text.

Next, play around with depth, angle (set to 0 or something) and blur and you should be able to get what you want.



回答4:

A full class and example using Geometries:

http://blogs.msdn.com/b/wpfsdk/archive/2006/12/24/using-text-as-a-decorative-graphic.aspx



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!