如何安装在VB.NET在用户机器上的字体,以便像Word应用程序可以使用它? [英] How do I install a font on a user's machine in VB.NET so applications like Word can use it?

查看:193
本文介绍了如何安装在VB.NET在用户机器上的字体,以便像Word应用程序可以使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要安装上的所有用户的机器上的字体,将使用我写的应用程序,它在Word中创建自定义的文件。这是一间酒吧code字型。

Need to install a font on all user's machines that will use the application I am writing which creates custom documents in Word. It's a barcode font.

我已经成功地将字体为我的解决方案,并将其生成操作嵌入的资源并且还成功地写入code,以检查字体在用户的系统上已安装。

I've successfully added the font to my solution and set its build action to Embedded Resource and have also successfully written code to check if the font is already installed on the user's system.

现在我只需要弄清楚如何从我的解决方案中提取字体并安装到用户的机器,如果他们安装的字体本身的Office应用程序中使用,等等。

Now I just need to figure out how to extract the font from my solution and install it onto the user's machine as if they installed the font themselves for use in Office applications, etc.

大部分时间我已经找到了例子,是使用VB.NET的应用程序中的字体,而不是外面和一个人的,我发现这似乎适合我的目的不是为我工作。

Most of the examples I've found out there are for using the font within the VB.NET application instead of outside it and the one's I have found which seem to fit my purpose aren't working for me.

推荐答案

字体复制到Windows字体文件夹,然后你需要获取字体添加到注册表。我还没有试过此我自己,但我认为这是可以通过使用 ShellExecuteA API以类似的方式打开字体看的这里

Copy the font into the Windows font folder and then you need to get the font added to the registry. I've not tried this myself, but I think it's possible to do this by opening the font using the ShellExecuteA api in a similar way to as seen here.

下面是做这件事的一个VBScript的方式,可能是因为你也许可以使用类似的语法和功能在VB.Net有用的作为起点:<一href="http://blogs.technet.com/b/heyscriptingguy/archive/2008/04/25/how-can-i-install-fonts-using-a-script.aspx"相对=nofollow>您好,脚本专家!如何安装字体使用脚本?

Here's a vbscript way of doing it that might be useful as a starting point since you might be able to use similar syntax and functions in VB.Net: Hey, Scripting Guy! How Can I Install Fonts Using a Script?

这篇关于如何安装在VB.NET在用户机器上的字体,以便像Word应用程序可以使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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