/// <summary> /// /// </summary> /// <param name="objForm"></param> public static void SetCultureFromResource(Controls.RibbonForm objForm) { try { var stack = new Stack <Control>(); objForm.Text = SpectrumResources.GetString(objForm.Name); foreach (Control ctrl in objForm.Controls) { try { stack.Push(ctrl); if (ctrl.GetType() == typeof(Spectrum.Controls.Label) || ctrl.GetType() == typeof(Spectrum.Controls.Button)) { ctrl.Text = SpectrumResources.GetString(string.Format("{0}.{1}", objForm.Name, ctrl.Name)); } else if (ctrl.GetType() == typeof(Spectrum.Controls.FlexGrid)) { C1FlexGrid grid = (C1FlexGrid)ctrl; for (int rowIndex = 0; rowIndex < grid.Cols.Count; rowIndex++) { grid.Cols[rowIndex].Caption = SpectrumResources.GetString(string.Format("{0}.{1}.{2}", objForm.Name, ctrl.Name, grid.Cols[rowIndex].Name)); } } } catch { } } while (stack.Count > 0) { try { var next = stack.Pop(); foreach (Control childControl in next.Controls) { stack.Push(childControl); if (childControl.GetType() == typeof(Spectrum.Controls.Label) || childControl.GetType() == typeof(Spectrum.Controls.Button)) { if (childControl.Name != "LabelText") { childControl.Text = SpectrumResources.GetString(string.Format("{0}.{1}", objForm.Name, childControl.Name)); } } else if (childControl.GetType() == typeof(Spectrum.Controls.LabelMandatory)) { ((Spectrum.Controls.LabelMandatory)(childControl)).NormalLabelText = SpectrumResources.GetString(string.Format("{0}.{1}", objForm.Name, childControl.Name)); } else if (childControl.GetType() == typeof(Spectrum.Controls.FlexGrid)) { C1FlexGrid grid = (C1FlexGrid)childControl; for (int rowIndex = 0; rowIndex < grid.Cols.Count; rowIndex++) { grid.Cols[rowIndex].Caption = SpectrumResources.GetString(string.Format("{0}.{1}.{2}", objForm.Name, childControl.Name, grid.Cols[rowIndex].Name)); } } } } catch { } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static string getResourceString(string resourceString) { return(SpectrumResources.GetString(resourceString)); }