public GUIWithUILanguage() { InitializeComponent(); // // Settings UI Language submenu // EventHandler eh = new EventHandler(MenuKeyboardUILangOnClick); List<ToolStripRadioButtonMenuItem> ar = new List<ToolStripRadioButtonMenuItem>(); String[] uiLangs = { "en-US", "it-IT", "lt-LT", "sk-SK", "vi-VN" }; foreach (string uiLang in uiLangs) { ToolStripRadioButtonMenuItem miuil = new ToolStripRadioButtonMenuItem(); CultureInfo ci = new CultureInfo(uiLang); miuil.Tag = ci.Name; miuil.Text = ci.Parent.DisplayName + " (" + ci.Parent.NativeName + ")"; miuil.CheckOnClick = true; miuil.Click += eh; ar.Add(miuil); } this.uiLanguageToolStripMenuItem.DropDownItems.AddRange(ar.ToArray()); }
protected override void OnCheckedChanged(EventArgs e) { base.OnCheckedChanged(e); // If this item is no longer in the checked state, do nothing. if (!Checked) { return; } // Clear the checked state for all siblings. foreach (ToolStripItem item in Parent.Items) { ToolStripRadioButtonMenuItem radioItem = item as ToolStripRadioButtonMenuItem; if (radioItem != null && radioItem != this && radioItem.Checked) { radioItem.Checked = false; // Only one item can be selected at a time, // so there is no need to continue. return; } } }
public GUIWithUILanguage() { InitializeComponent(); // // Settings UI Language submenu // EventHandler eh = new EventHandler(MenuKeyboardUILangOnClick); List<ToolStripRadioButtonMenuItem> ar = new List<ToolStripRadioButtonMenuItem>(); String[] uiLangs = { "ca-ES", "cs-CZ", "en-US", "fa-IR", "it-IT", "lt-LT", "ja-JP", "nl-NL", "sk-SK", "tr-TR", "vi-VN" }; // "bn-IN" caused exception on WinXP .NET 2.0 foreach (string uiLang in uiLangs) { ToolStripRadioButtonMenuItem miuil = new ToolStripRadioButtonMenuItem(); CultureInfo ci = new CultureInfo(uiLang); miuil.Tag = ci.Name; miuil.Text = ci.Parent.DisplayName + " (" + ci.Parent.NativeName + ")"; if (ci.Parent.DisplayName.StartsWith("Invariant Language")) { miuil.Text = ci.EnglishName.Substring(0, ci.EnglishName.IndexOf("(") - 1) + " (" + ci.NativeName.Substring(0, ci.NativeName.IndexOf("(") - 1) + ")"; } miuil.CheckOnClick = true; miuil.Click += eh; ar.Add(miuil); } this.uiLanguageToolStripMenuItem.DropDownItems.AddRange(ar.ToArray()); }
public GUIWithInputMethod() { // Sets the UI culture to the selected language. Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedUILanguage); InitializeComponent(); // // Keyboard InputMethod submenu // EventHandler eh = new EventHandler(MenuKeyboardInputMethodOnClick); List<ToolStripRadioButtonMenuItem> ar = new List<ToolStripRadioButtonMenuItem>(); foreach (string inputMethod in Enum.GetNames(typeof(InputMethods))) { ToolStripRadioButtonMenuItem miim = new ToolStripRadioButtonMenuItem(); miim.Text = inputMethod; miim.CheckOnClick = true; miim.Click += eh; ar.Add(miim); } this.vietInputMethodToolStripMenuItem.DropDownItems.AddRange(ar.ToArray()); this.textBox1.KeyPress += new KeyPressEventHandler(new VietKeyHandler(this.textBox1).OnKeyPress); // // Keyboard UI Language submenu // EventHandler eh1 = new EventHandler(MenuKeyboardUILangOnClick); ar.Clear(); String[] uiLangs = { "en-US", "vi-VN" }; foreach (string uiLang in uiLangs) { ToolStripRadioButtonMenuItem miuil = new ToolStripRadioButtonMenuItem(); CultureInfo ci = new CultureInfo(uiLang); miuil.Tag = ci.Name; miuil.Text = ci.Parent.DisplayName; miuil.CheckOnClick = true; miuil.Click += eh1; ar.Add(miuil); } this.uILanguageToolStripMenuItem.DropDownItems.AddRange(ar.ToArray()); }
public GUIWithPSM() { Dictionary<string, string> psmDict = new Dictionary<string, string>(); psmDict.Add("OsdOnly", "0 - Orientation and script detection (OSD) only"); psmDict.Add("AutoOsd", "1 - Automatic page segmentation with OSD"); psmDict.Add("AutoOnly", "2 - Automatic page segmentation, but no OSD, or OCR"); psmDict.Add("Auto", "3 - Fully automatic page segmentation, but no OSD (default)"); psmDict.Add("SingleColumn", "4 - Assume a single column of text of variable sizes"); psmDict.Add("SingleBlockVertText", "5 - Assume a single uniform block of vertically aligned text"); psmDict.Add("SingleBlock", "6 - Assume a single uniform block of text"); psmDict.Add("SingleLine", "7 - Treat the image as a single text line"); psmDict.Add("SingleWord", "8 - Treat the image as a single word"); psmDict.Add("CircleWord", "9 - Treat the image as a single word in a circle"); psmDict.Add("SingleChar", "10 - Treat the image as a single character"); psmDict.Add("Count", "11 - Number of enum entries"); InitializeComponent(); // // Settings PageSegMode submenu // EventHandler eh = new EventHandler(MenuPSMOnClick); List<ToolStripRadioButtonMenuItem> ar = new List<ToolStripRadioButtonMenuItem>(); foreach (string mode in Enum.GetNames(typeof(PageSegMode))) { if ((PageSegMode)Enum.Parse(typeof(PageSegMode), mode) == PageSegMode.Count) { continue; } ToolStripRadioButtonMenuItem psmItem = new ToolStripRadioButtonMenuItem(); psmItem.Text = psmDict[mode]; psmItem.Tag = mode; psmItem.CheckOnClick = true; psmItem.Click += eh; ar.Add(psmItem); } this.psmToolStripMenuItem.DropDownItems.AddRange(ar.ToArray()); }
public GUIWithPSM() { Dictionary<string, string> psmDict = new Dictionary<string, string>(); psmDict.Add("PSM_OSD_ONLY", "0 - Orientation and script detection (OSD) only"); psmDict.Add("PSM_AUTO_OSD", "1 - Automatic page segmentation with OSD"); psmDict.Add("PSM_AUTO_ONLY", "2 - Automatic page segmentation, but no OSD, or OCR"); psmDict.Add("PSM_AUTO", "3 - Fully automatic page segmentation, but no OSD (default)"); psmDict.Add("PSM_SINGLE_COLUMN", "4 - Assume a single column of text of variable sizes"); psmDict.Add("PSM_SINGLE_BLOCK_VERT_TEXT", "5 - Assume a single uniform block of vertically aligned text"); psmDict.Add("PSM_SINGLE_BLOCK", "6 - Assume a single uniform block of text"); psmDict.Add("PSM_SINGLE_LINE", "7 - Treat the image as a single text line"); psmDict.Add("PSM_SINGLE_WORD", "8 - Treat the image as a single word"); psmDict.Add("PSM_CIRCLE_WORD", "9 - Treat the image as a single word in a circle"); psmDict.Add("PSM_SINGLE_CHAR", "10 - Treat the image as a single character"); psmDict.Add("PSM_COUNT", "11 - Number of enum entries"); InitializeComponent(); // // Settings PageSegMode submenu // EventHandler eh = new EventHandler(MenuPSMOnClick); List<ToolStripRadioButtonMenuItem> ar = new List<ToolStripRadioButtonMenuItem>(); foreach (string mode in Enum.GetNames(typeof(ePageSegMode))) { if ((ePageSegMode)Enum.Parse(typeof(ePageSegMode), mode) == ePageSegMode.PSM_COUNT) { continue; } ToolStripRadioButtonMenuItem psmItem = new ToolStripRadioButtonMenuItem(); psmItem.Text = psmDict[mode]; psmItem.Tag = mode; psmItem.CheckOnClick = true; psmItem.Click += eh; ar.Add(psmItem); } this.psmToolStripMenuItem.DropDownItems.AddRange(ar.ToArray()); }
public GUIWithInputMethod() { InitializeComponent(); // // Settings InputMethod submenu // EventHandler eh = new EventHandler(MenuKeyboardInputMethodOnClick); List<ToolStripRadioButtonMenuItem> ar = new List<ToolStripRadioButtonMenuItem>(); foreach (string inputMethod in Enum.GetNames(typeof(InputMethods))) { ToolStripRadioButtonMenuItem miim = new ToolStripRadioButtonMenuItem(); miim.Text = inputMethod; miim.CheckOnClick = true; miim.Click += eh; ar.Add(miim); } this.vietInputMethodToolStripMenuItem.DropDownItems.AddRange(ar.ToArray()); this.textBox1.KeyPress += new KeyPressEventHandler(new VietKeyHandler(this.textBox1).OnKeyPress); }