Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# windows xp上的Syncfusion网格字体_C#_.net_Syncfusion - Fatal编程技术网

C# windows xp上的Syncfusion网格字体

C# windows xp上的Syncfusion网格字体,c#,.net,syncfusion,C#,.net,Syncfusion,在windows XP中设置GridGroupingControl的字体对我来说似乎是个问题 代码如下: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.autoLabel1.Font = new Font(Fonts.GetFontFamily(), 10f); thi

在windows XP中设置GridGroupingControl的字体对我来说似乎是个问题

代码如下:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            this.autoLabel1.Font = new Font(Fonts.GetFontFamily(), 10f);
            this.normalLabel.Font = new Font(Fonts.GetFontFamily(), 10f);
            this.gridGroupingControl1.Font = new Font(Fonts.GetFontFamily(), 10f);
        }
    }

public static class Fonts
    {
        private static PrivateFontCollection pfc;

        public static System.Drawing.FontFamily GetFontFamily()
        {

            try
            {
                if (pfc == null)
                {
                    pfc = new PrivateFontCollection();

                    AddMemoryFont(Properties.Resources.OpenSans_Bold);
                    AddMemoryFont(Properties.Resources.OpenSans_BoldItalic);
                    AddMemoryFont(Properties.Resources.OpenSans_ExtraBold);
                    AddMemoryFont(Properties.Resources.OpenSans_ExtraBoldItalic);
                    AddMemoryFont(Properties.Resources.OpenSans_Italic);
                    AddMemoryFont(Properties.Resources.OpenSans_Light);
                    AddMemoryFont(Properties.Resources.OpenSans_LightItalic);
                    AddMemoryFont(Properties.Resources.OpenSans_Regular);
                    AddMemoryFont(Properties.Resources.OpenSans_Semibold);
                    AddMemoryFont(Properties.Resources.OpenSans_SemiboldItalic);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return pfc.Families.FirstOrDefault();
        }

        [DllImport("gdi32.dll")]
        private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts);


        private static void AddMemoryFont(byte[] fontResource)
        {
            try
            {
                IntPtr p;
                uint c = 0;

                p = Marshal.AllocCoTaskMem(fontResource.Length);
                Marshal.Copy(fontResource, 0, p, fontResource.Length);
                AddFontMemResourceEx(p, (uint)fontResource.Length, IntPtr.Zero, ref c);
                pfc.AddMemoryFont(p, fontResource.Length);
                Marshal.FreeCoTaskMem(p);

                p = IntPtr.Zero;
            }
            catch
            {
                throw;
            }
        }
    }
在windows7上运行此应用程序时,在网格中显示正确的字体没有问题,但在windows XP上运行同一应用程序时,网格中的字体实际上是默认字体(MS SAN)

编辑:当我使用将此字体设置为其他syncfusion控件时,它工作正常


如何解决他的问题?实际上有什么方法可以做到这一点,或者我做错了什么吗?

顺便说一句,我不确定你想
抛出ex您的评论中没有任何有用的内容。一些客户仍在使用此操作系统。顺便说一下,
throw-ex在此不重要,请在support@syncfusion.com
throw-ex
只是一个一般性建议,因为它清除了
innerException
。“如果你不能花一点时间去笑,生活又有什么意义呢?”已经有人问过了support@syncfusion.com. 顺便说一句,没有回应,我不确定你想
抛出ex您的评论中没有任何有用的内容。一些客户仍在使用此操作系统。顺便说一下,
throw-ex在此不重要,请在support@syncfusion.com
throw-ex
只是一个一般性建议,因为它清除了
innerException
。“如果你不能花一点时间去笑,生活又有什么意义呢?”已经有人问过了support@syncfusion.com. 没有回应