C/S程序 希望客户端用户使用微软雅黑字体
如果存在该字体则不安装 如果不存在 则安装此字体 应该如何做呢

解决方案 »

  1.   

            private void button1_Click(object sender, EventArgs e)
            {
                           StringBuilder _DirectoryBuilder =new StringBuilder();
                GetWindowsDirectory(_DirectoryBuilder, 100);            string _WindowsDirectory = _DirectoryBuilder.ToString();
                if (!System.IO.File.Exists(_WindowsDirectory + "\\Fonts\\雅黑字体.ttf"))
                {
                    System.IO.File.Copy(Application.StartupPath + "\\雅黑字体.ttf", _WindowsDirectory + "\\Fonts\\雅黑字体.ttf");
                }              
            }        [DllImport("kernel32.dll")]
            public static extern void GetWindowsDirectory(StringBuilder WinDir, int count);