如何将cstring转换为cfont * [英] How do I convert cstring to cfont*

查看:76
本文介绍了如何将cstring转换为cfont *的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个C#应用程序,它使用FontConverter类将Font转换为String并写入文件。



现在,我需要在MFC应用程序中读取此文件并将写入的字体(作为字符串)转换为CFont对象。



简而言之,我需要在MFC中实现以下。

FontConverter fontConverter = new FontConverter();

Font font = fontConverter.ConvertFromInvariantString(fontData)as Font;



任何帮助都将受到高度赞赏。



谢谢,

Kishor



我尝试了什么:



直到现在,我按原样阅读字符串解析为所需的内容。



例如,如果字符串是Monotype Corsiva,15.75pt,style = Bold,Italic我单独解析并创建了CFont对象。 />


还有更好的方法吗?

Hi All,

I have a C# application which converts the Font to String using FontConverter class and writes to a file.

Now, i need to read this file in MFC application and convert the written Font (as string) to CFont object.

In short, i need to implement the below in MFC.
FontConverter fontConverter = new FontConverter();
Font font = fontConverter.ConvertFromInvariantString(fontData) as Font;

Any help would be highly appreciated.

Thanks,
Kishor

What I have tried:

Till now, i read the string as is and parsed to required contents.

For example if the string is "Monotype Corsiva, 15.75pt, style=Bold, Italic" i parsed seperately and created CFont object.

Is there any better way ?

推荐答案

根据 CFont类 [ ^ ]没有内置方法可以做你想做的事。
According to CFont Class[^] there is no built in method to do what you want.


这篇关于如何将cstring转换为cfont *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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