示例#1
0
 public static void SetResourceCulture(Control.ControlCollection items, Assembly userAssembly)
 {
     //遍历所有控件
     foreach (Control item in items)
     {
         string strTextTmp = item.Text;
         if (ResourceCulture.GetString(item.Name + "_Text", ref strTextTmp, userAssembly))
         {
             item.Text = strTextTmp;
         }
         if ((item.Controls.Count != 0))
         {
             SetResourceCulture(item.Controls, userAssembly);
         }
     }
 }
示例#2
0
 public static void SetResourceCulture(ToolStripItemCollection items, Assembly userAssembly)
 {
     //遍历所有控件
     foreach (object item in items)
     {
         try
         {
             string strTextTmp = ((ToolStripMenuItem)item).Text;
             if (ResourceCulture.GetString(((ToolStripMenuItem)item).Name + "_Text", ref strTextTmp, userAssembly))
             {
                 ((ToolStripMenuItem)item).Text = strTextTmp;
             }
             if ((((ToolStripMenuItem)item).DropDownItems.Count != 0))
             {
                 SetResourceCulture(((ToolStripMenuItem)item).DropDownItems, userAssembly);
             }
         }
         catch (Exception err)
         {
             Debug.WriteLine(err.Message);
         }
     }
 }