在c#中有没有方法可以获得系统默认设置的字体?比如:在中国大陆,默认设置的是宋体。在台湾地区系统默认设置的是“Tw Cen MT”。
在线等待!!

解决方案 »

  1.   

    C#// The following method displays the default font, 
    // background color and foreground color values for the ListBox  
    // control. The values are displayed in the ListBox, itself.private void Populate_ListBox()
    {
        ListBox1.Dock = DockStyle.Bottom;    // Display the values in the read-only properties 
        // DefaultBackColor, DefaultFont, DefaultForecolor.
        ListBox1.Items.Add("Default BackColor: " + 
            ListBox.DefaultBackColor.ToString());
        ListBox1.Items.Add("Default Font: " + 
            ListBox.DefaultFont.ToString());
        ListBox1.Items.Add("Default ForeColor:" + 
            ListBox.DefaultForeColor.ToString());}
      

  2.   

    谢谢:oolongTea(江山留胜迹,我辈复登临。) 
    但我的目的不是得到某个控件的字体信息。而是系统的默认字体。然后用系统的默认字体设置到每个控件。
      

  3.   

    控件的默认字体就是系统的默认字体,两者相同,
    你这样做是无用功,
    如果非这样不可
    可从注册表
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\GRE_Initialize]
    读取"GUIFont.Facename"字段
    然后赋值给控件的字体
      

  4.   

    得到系统默认字体
     private FontFamily[] fontFamilys;        private void GetFontFamilies()
            {
                Graphics g = this.CreateGraphics();
                fontFamilys = FontFamily.GetFamilies(g);
                for (int i = 0; i < fontFamilys.Length; i++)
                {
                    cbxFont.Items.Add(fontFamilys[i].Name);
                }
            }