【发布时间】:2013-11-21 06:57:28
【问题描述】:
在我的项目使用字体中, 用于在 ClickOnce 时安装字体。
string strFontsPathFile = Environment.GetEnvironmentVariable("windir")
+ @"\Fonts\" + strFileName;
File.Copy(strFontFilePath, strFontsPathFile, true);
//2)Step 2 : Install font in resource of MS-Windows
if (AddFontResource(strFontsPathFile) == 0)
return false;
//3)Step 3 : Set registry information of new installed font for use
RegistryKey reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts", true);
reg.SetValue(strFileName.Split('.')[0] + " (TrueType)", strFileName);
reg.Close();
SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);
但错误:
对路径 '' 的访问被拒绝。
【问题讨论】: