public WindowPane() { InitializeComponent(); ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(components); ToolStripRadioButtonMenuItem top = new ToolStripRadioButtonMenuItem("Top"); ContextMenuStrip.Items.Add(top); ToolStripRadioButtonMenuItem bottom = new ToolStripRadioButtonMenuItem("Bottom"); ContextMenuStrip.Items.Add(bottom); this.windowHeader = new WindowHeader(ContextMenuStrip, PointToScreen); windowHeader.OnCloseClicked += windowHeader_OnCloseClicked; this.Text = "WindowPane"; this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); GraphicManager = BufferedGraphicsManager.Current; GraphicManager.MaximumBuffer = new Size(this.Width + 1, this.Height + 1); ManagedBackBuffer = GraphicManager.Allocate(this.CreateGraphics(), ClientRectangle); }
public GUIWithOEM() { Dictionary <string, string> oemDict = new Dictionary <string, string>(); oemDict.Add("TesseractOnly", "0 - Tesseract only"); oemDict.Add("CubeOnly", "1 - Cube only"); oemDict.Add("TesseractAndCube", "2 - Tesseract && Cube"); oemDict.Add("Default", "3 - Default"); InitializeComponent(); // // Settings OCR Engine Mode submenu // EventHandler eh = new EventHandler(MenuOEMOnClick); List <ToolStripRadioButtonMenuItem> ar = new List <ToolStripRadioButtonMenuItem>(); foreach (string mode in Enum.GetNames(typeof(EngineMode))) { ToolStripRadioButtonMenuItem oemItem = new ToolStripRadioButtonMenuItem(); oemItem.Text = oemDict[mode]; oemItem.Tag = mode; oemItem.CheckOnClick = true; oemItem.Click += eh; ar.Add(oemItem); } this.oemToolStripMenuItem.DropDownItems.AddRange(ar.ToArray()); }
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()); }
//</snippet110> //<snippet120> protected override void OnCheckedChanged(EventArgs e) { base.OnCheckedChanged(e); // If this item is no longer in the checked state or if its // parent has not yet been initialized, do nothing. if (!Checked || this.Parent == null) { 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", "de-DE", "fa-IR", "hi-IN", "it-IT", "lt-LT", "ja-JP", "nl-NL", "pl-PL", "ru-RU", "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()); }
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 && !object.ReferenceEquals(radioItem, this) && radioItem.Checked) { radioItem.Checked = false; // Only one item can be selected at a time, // so there is no need to continue. return; } } }
private static ToolStripMenuItem CommandToButton(IToolbarCommand command) { var button = new ToolStripMenuItem(); if (command.IsOption) { button = new ToolStripRadioButtonMenuItem(); } button.Checked = command.Checked; button.CheckOnClick = command.CheckOnClick; button.ToolTipText = command.ToolTip?.Replace(@"&", ""); button.Text = command.Text; button.Image = command.Icon; button.Enabled = command.IsEnabled; button.Visible = command.Visible; button.ImageScaling = ToolStripItemImageScaling.SizeToFit; button.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; button.ShowShortcutKeys = true; button.ShortcutKeyDisplayString = command.ShortcutKeyString; var c = command; // create a closure around the command command.PropertyChanged += (o, s) => { button.ShortcutKeyDisplayString = c.ShortcutKeyString; button.CheckOnClick = c.CheckOnClick; button.Checked = c.Checked; button.ToolTipText = c.ToolTip; button.Visible = c.Visible; button.Text = c.Text; button.Image = c.Icon; button.Enabled = c.IsEnabled; }; if (!(command is DummyCommand)) { button.Click += (sender, args) => c.Execute(); button.MouseDown += (sender, args) => { if (args.Button != MouseButtons.Left && !(SystemInformation.MouseButtonsSwapped #if !__MonoCS__ || System.Windows.SystemParameters.SwapButtons #endif )) { c.Execute(); } else if (args.Button != MouseButtons.Right && (SystemInformation.MouseButtonsSwapped #if !__MonoCS__ || System.Windows.SystemParameters.SwapButtons #endif )) { c.Execute(); } }; } return(button); }
private void Rb_CheckedChanged(object sender, EventArgs e) { ToolStripRadioButtonMenuItem rb = sender as ToolStripRadioButtonMenuItem; if (rb != null && rb.Checked) { _mainPanel.SetEditSort((EditSort)rb.Tag); } }
private void _setEditSort(EditSort editSort) { foreach (ToolStripItem dropDownItem in dayInfoSortToolStripMenuItem.DropDownItems) { ToolStripRadioButtonMenuItem rb = dropDownItem as ToolStripRadioButtonMenuItem; if (rb != null && ((EditSort)rb.Tag) == editSort) { rb.Checked = true; } } }
public void AddEnumClipboardContentWithRuntimeSettings(ToolStripDropDownButton tsddb, List <ClipboardContentEnum> ClipboardContentType) { if (tsddb.DropDownItems.Count == 0) { foreach (ClipboardContentEnum t in Enum.GetValues(typeof(ClipboardContentEnum))) { ToolStripRadioButtonMenuItem tsmi = new ToolStripRadioButtonMenuItem(t.GetDescription()); tsmi.Tag = t; tsmi.Checked = ClipboardContentType.Contains(t); tsmi.Click += new EventHandler(tsmiDestClipboardContent_Click); tsddb.DropDownItems.Add(tsmi); } } UpdateToolStripClipboardContent(); ucDestOptions.EnableDisableDestControls(); }
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()); }
// Protected override methods protected override void OnCheckedChanged(EventArgs e) { base.OnCheckedChanged(e); if (!this.Checked) { return; } foreach (ToolStripItem item in this.Parent.Items) { ToolStripRadioButtonMenuItem rbItem = item as ToolStripRadioButtonMenuItem; if (rbItem != null && rbItem != this && rbItem.Checked) { rbItem.Checked = false; return; } } }
public void SetMenuLang(string lang, bool regLang) { if (regLang) { foreach (object obj in this.m_TSMILang.DropDownItems) { ToolStripRadioButtonMenuItem item = obj as ToolStripRadioButtonMenuItem; if (item != null && item.Name == lang) { item.Checked = true; return; } } } this.m_TSMISystem.Checked = true; }
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("SparseText", "11 - Find as much text as possible in no particular order"); psmDict.Add("SparseTextOsd", "12 - Sparse text with orientation and script detection"); psmDict.Add("RawLine", "13 - Treat the image as a single text line, bypassing hacks that are Tesseract-specific"); psmDict.Add("Count", "14 - 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 UTEnote() { InitializeComponent(); txtTag.watermark = "Add a tag..."; sort = "created"; isMenuToggled = false; isInfoToggled = false; IsSidebarToggled = true; tags = new List <string>(); txtSearch.watermark = "All Notes"; NoteList = new List <Note>(); ToolStripRadioButtonMenuItem datemod = new ToolStripRadioButtonMenuItem("Date modified"); ToolStripRadioButtonMenuItem datecreate = new ToolStripRadioButtonMenuItem("Date created"); ToolStripRadioButtonMenuItem alphabetical = new ToolStripRadioButtonMenuItem("Alphabetical"); datecreate.Checked = true; datemod.Click += Datemod_Click; datecreate.Click += Datecreate_Click; alphabetical.Click += Alphabetical_Click; sortTypeToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { datemod, datecreate, alphabetical }); }
private static ToolStripMenuItem CommandToButton(IToolbarCommand command) { var button = new ToolStripMenuItem(); if (command.IsOption) { button = new ToolStripRadioButtonMenuItem(); } button.Checked = command.Checked; button.CheckOnClick = command.CheckOnClick; button.ToolTipText = command.ToolTip?.Replace(@"&", ""); button.Text = command.Text; button.Image = command.Icon; button.Enabled = command.IsEnabled; button.Visible = command.Visible; button.ImageScaling = ToolStripItemImageScaling.None; button.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; button.ShowShortcutKeys = true; button.ShortcutKeyDisplayString = command.ShortcutKeyString; var c = command; // create a closure around the command command.PropertyChanged += (o, s) => { button.ShortcutKeyDisplayString = c.ShortcutKeyString; button.CheckOnClick = c.CheckOnClick; button.Checked = c.Checked; button.ToolTipText = c.ToolTip; button.Visible = c.Visible; button.Text = c.Text; button.Image = c.Icon; button.Enabled = c.IsEnabled; }; if (!(command is DummyCommand)) { button.Click += (sender, args) => c.Execute(); } return(button); }
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); }
private void p_LanguageMenu() { // System language this.m_TSMISystem = new ToolStripRadioButtonMenuItem(); this.m_TSMISystem.Name = "TSMI-System"; this.m_TSMISystem.Click += new EventHandler(this.M_TSMISystem_Click); this.m_TSMILang.DropDownItems.Add(this.m_TSMISystem); // ToolStripSeparator this.m_TSMILang.DropDownItems.Add(new ToolStripSeparator()); // Add other language ToolStripRadioButtonMenuItem tsmi = null; tsmi = new ToolStripRadioButtonMenuItem("English"); tsmi.Name = "en"; tsmi.Click += new EventHandler(this.M_tsmi_Click); this.m_TSMILang.DropDownItems.Add(tsmi); tsmi = new ToolStripRadioButtonMenuItem("Русский"); tsmi.Name = "ru"; tsmi.Click += new EventHandler(this.M_tsmi_Click); this.m_TSMILang.DropDownItems.Add(tsmi); }
public Form1() { InitializeComponent(); #if DEBUG == true for (int i = 0; i < 16; i++) { ActionTypes at_A = (ActionTypes)i; string s1 = ""; string s2 = ""; string s3 = ""; s1 += (at_A.BinaryString(4) + " : "); s2 += ("ANY : "); s3 += ("HAS : "); for (int j = 0; j < 16; j++) { ActionTypes at_B = (ActionTypes)j; s1 += (at_B.BinaryString(4) + " "); s2 += (at_A.HasAny(at_B) ? "TRUE " : "FALSE "); s3 += (at_A.HasFlag(at_B) ? "TRUE " : "FALSE "); } Console.WriteLine(s1); Console.WriteLine(s2); Console.WriteLine(s3); Console.WriteLine(); } #endif notifyIcon1.BalloonTipClosed += (sender, e) => { var thisIcon = (NotifyIcon)sender; thisIcon.Visible = false; thisIcon.Dispose(); }; // watch this file structure _fcWatcher = new FileChangeWatcher { Extensions = new[] { ".cs" } }; _fcWatcher.Changed += FolderChangeWatcher_Changed; _fcWatcher.Error += FolderChangeWatcher_Error; eventScroller1.FileChangeWatcher = _fcWatcher; _themeController = new ThemeController(); _themeController.Changed += Themer_Changed; _mainPanel = new MainPanel(_fcWatcher, doubleBuffer1, _themeController.Theme); this.Icon = notifyIcon1.Icon; BaseForm.ApplicationIcon = notifyIcon1.Icon; toolStripTextBoxWithLabelIdleTime.LabelText = "Idle Time(m)"; toolStripTextBoxWithLabelTimePerEdit.LabelText = "Per Edit Time(m)"; toolStripTextBoxWithLabelIdleTime.Set(_fcWatcher.UserIdleMinutes); toolStripTextBoxWithLabelTimePerEdit.Set(_fcWatcher.PerEditMinutes); toolStripTextBoxWithLabelIdleTime.TextBox.EnterPressed += TextBox_EnterPressed; toolStripTextBoxWithLabelTimePerEdit.TextBox.EnterPressed += TextBox_EnterPressed1; useIdleEventsToolStripMenuItem.Checked = _fcWatcher.UseIdleEvents; advancedToolStripMenuItem.DropDownClosed += AdvancedToolStripMenuItem_DropDownClosed; foreach (var eSrt in Enum.GetValues(typeof(EditSort))) { ToolStripRadioButtonMenuItem rb = new ToolStripRadioButtonMenuItem(eSrt.ToString()); rb.Tag = eSrt; dayInfoSortToolStripMenuItem.DropDownItems.Add(rb); rb.CheckedChanged += Rb_CheckedChanged; } Application.Idle += Application_Idle; }