如何在不使用文本框的情况下更改普通字符串的字体类型? [英] How to change font type of a normal string without using a text box?

查看:64
本文介绍了如何在不使用文本框的情况下更改普通字符串的字体类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要创建一个函数来生成礼品券.礼品券是一个HTML文件,我正在使用字符串函数来编辑凭证号,有效日期和材料.礼品券中有某些元素需要复选框.幸运的是,Wingdings 2字体中有一个字符代表一个复选框.我需要将该字符传递给所有应带有刻度线的元素.我该怎么做?

Hi,
I need to create a function to generate gift vouchers. The Gift Voucher is an HTML file and I''m using string functions to edit the voucher number, valid dates and stuff. In the gift voucher there are certain elements that require check boxes. Fortunately there is a character in Wingdings 2 font that represents a check box. I need to pass that character to all the elements that should have a tick mark. How do I do it? Is it even possible?

推荐答案

字符串没有字体或任何此类格式.

如何执行此操作完全取决于用于显示字符串的控件.控件进行格式化,或者在您的情况下,HTML进行格式化.

只要提供HTML即可以任何方式格式化输出.将字符串分解为将要相互格式化的组件,然后您就可以按照自己的方式格式化每个组件.
Strings don''t have a font or any such formatting.

How you do this depends entirely on the control being used to display the string. The control does the formatting, or in your case, the HTML does it.

You can format the output any way you want, so long as you supply the HTML to do it. Break up the string into the components that are going to be formatted differently from each other and you can format each piece any way you want.


两条CodeProject文章提供了非常有用且健壮的控件来呈现HTML,一个用于System.Windows.Forms,另一个用于WPF:

您将使用的专业HTML渲染器 [ WPF HTML支持的文本块 [
Two CodeProject articles provide very useful and robust controls to render HTML, one for System.Windows.Forms, another for WPF:

A Professional HTML Renderer You Will Use[^],
WPF HTML Supported TextBlock[^].

—SA


这篇关于如何在不使用文本框的情况下更改普通字符串的字体类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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