WPF字体和System.Drawing.Font之间的区别 [英] Difference between WPF font and System.Drawing.Font

查看:584
本文介绍了WPF字体和System.Drawing.Font之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何更换System.Drawing.Font Header = new Font(FontFamily.GenericSansSerif,15,FontStyle.Bold);
到WPF字体类.

问候,
sajith


How to replace System.Drawing.Font Header = new Font(FontFamily.GenericSansSerif,15,FontStyle.Bold);
to WPF font class.

Regards,
sajith

推荐答案

首先,差异"的概念是完全不确定的.我认为您无法以任何方式解释它.

您需要了解的是,这两个类彼此无关.他们在不同的系统中表达相同的想法.最好将System.Windows.Forms + System.Drawing和WPF视为两个彼此不接触的平行单词.

实际上,有一些互操作性模块用于在它们之间转换图像,并将WPF控件托管在Form中,而将System.Windows.Forms控件托管在WPF窗口中,但是它们在体系结构和实现上都非常糟糕.除非有迫切需要,否则最好避免使用它们.

—SA
First of all, the notion of "difference" is totally undefined. I don''t think you can explain it anyhow.

All you need to understand is that these two classes have nothing to do with each other; they express the same idea in different systems. It''s also the best to treat System.Windows.Forms+System.Drawing and WPF as two different parallel words not touching each other.

In fact, there are interoperability modules used to convert images between them, and to host WPF controls in a Form and System.Windows.Forms controls in a WPF Window, but they are monstrous in architecture and implementation; and it''s they should better be avoided unless there is some desperate need.

—SA


System.Drawing.Font(WinForms)和System.Windows.Media.FontFamily(WPF)之间没有一对一的映射.

看看FontFamily 此处 [ ^ ]并尝试使用它在您自己的实现中.
There is no one to one mapping between System.Drawing.Font (WinForms) and System.Windows.Media.FontFamily (WPF).

Have a look at the FontFamily class here[^] and try using it in your own implementation.


这篇关于WPF字体和System.Drawing.Font之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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