Example #1
0
        /// <summary>
        /// Occurs when the button is clicked.
        /// </summary>
        /// <param name="sender">Sender of the event.</param>
        /// <param name="e">Event arguments.</param>
        private void findInsertButton_Click(object sender, System.EventArgs e)
        {
            OwnerDrawContextMenu menu = new OwnerDrawContextMenu();

            if (searchTypeDropDownList.SelectedIndex == 0)
            {
                menu.MenuItems.Add(new OwnerDrawMenuItem(". Any single character", -1, new EventHandler(menuItem_Click), Shortcut.None, "."));
                menu.MenuItems.Add(new OwnerDrawMenuItem("* Zero or more", -1, new EventHandler(menuItem_Click), Shortcut.None, "*"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("+ One or more", -1, new EventHandler(menuItem_Click), Shortcut.None, "+"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("-"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("^ Beginning of line", -1, new EventHandler(menuItem_Click), Shortcut.None, "^"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("$ End of line", -1, new EventHandler(menuItem_Click), Shortcut.None, "$"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("\\b Word boundary", -1, new EventHandler(menuItem_Click), Shortcut.None, "\\b"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("\\s Whitespace", -1, new EventHandler(menuItem_Click), Shortcut.None, "\\s"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("\\n Line break", -1, new EventHandler(menuItem_Click), Shortcut.None, "\\n"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("-"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("[ ] Any one character in the set", -1, new EventHandler(menuItem_Click), Shortcut.None, "[ ]"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("[^ ] Any one character not in the set", -1, new EventHandler(menuItem_Click), Shortcut.None, "[^ ]"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("| Or", -1, new EventHandler(menuItem_Click), Shortcut.None, "|"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("\\ Escape special character", -1, new EventHandler(menuItem_Click), Shortcut.None, "\\"));
            }
            else
            {
                menu.MenuItems.Add(new OwnerDrawMenuItem("* Zero or more of any character", -1, new EventHandler(menuItem_Click), Shortcut.None, "*"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("? Any single character", -1, new EventHandler(menuItem_Click), Shortcut.None, "?"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("# Any single digit", -1, new EventHandler(menuItem_Click), Shortcut.None, "#"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("[ ] Any one character in the set", -1, new EventHandler(menuItem_Click), Shortcut.None, "[ ]"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("[! ] Any one character not in the set", -1, new EventHandler(menuItem_Click), Shortcut.None, "[! ]"));
            }
            menu.Show(findInsertButton, new Point(findInsertButton.ClientRectangle.Right, findInsertButton.ClientRectangle.Top));
        }
        /// <summary>
        /// Occurs when the button is clicked.
        /// </summary>
        /// <param name="sender">Sender of the event.</param>
        /// <param name="e">Event arguments.</param>
        private void findInsertButton_Click(object sender, System.EventArgs e)
        {
            OwnerDrawContextMenu menu = new OwnerDrawContextMenu();

            if (searchTypeDropDownList.SelectedIndex == 0)
            {
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_SingleCharacter"), -1, new EventHandler(menuItem_Click), Shortcut.None, "."));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_ZeroOrMore"), -1, new EventHandler(menuItem_Click), Shortcut.None, "*"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_OneOrMore"), -1, new EventHandler(menuItem_Click), Shortcut.None, "+"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("-"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_BeginningOfLine"), -1, new EventHandler(menuItem_Click), Shortcut.None, "^"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_EndOfLine"), -1, new EventHandler(menuItem_Click), Shortcut.None, "$"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_WordBoundary"), -1, new EventHandler(menuItem_Click), Shortcut.None, "\\b"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_Whitespace"), -1, new EventHandler(menuItem_Click), Shortcut.None, "\\s"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_LineBreak"), -1, new EventHandler(menuItem_Click), Shortcut.None, "\\n"));
                menu.MenuItems.Add(new OwnerDrawMenuItem("-"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_OneCharacterInSet"), -1, new EventHandler(menuItem_Click), Shortcut.None, "[ ]"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_OneCharacterNotInSet"), -1, new EventHandler(menuItem_Click), Shortcut.None, "[^ ]"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_Or"), -1, new EventHandler(menuItem_Click), Shortcut.None, "|"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_CharacterEscape"), -1, new EventHandler(menuItem_Click), Shortcut.None, "\\"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_Group"), -1, new EventHandler(menuItem_Click), Shortcut.None, "( )"));
            }
            else
            {
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_ZeroOrMore"), -1, new EventHandler(menuItem_Click), Shortcut.None, "*"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_AnySingleCharacter"), -1, new EventHandler(menuItem_Click), Shortcut.None, "?"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_AnySingleDigit"), -1, new EventHandler(menuItem_Click), Shortcut.None, "#"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_OneCharacterInSet"), -1, new EventHandler(menuItem_Click), Shortcut.None, "[ ]"));
                menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_OneCharacterNotInSet"), -1, new EventHandler(menuItem_Click), Shortcut.None, "[! ]"));
            }
            menu.Show(findInsertButton, new Point(findInsertButton.ClientRectangle.Right, findInsertButton.ClientRectangle.Top));
        }
Example #3
0
 /// <summary>
 /// Occurs when the button is clicked.
 /// </summary>
 /// <param name="sender">Sender of the event.</param>
 /// <param name="e">Event arguments.</param>
 private void findInsertButton_Click(object sender, System.EventArgs e)
 {
     OwnerDrawContextMenu menu = new OwnerDrawContextMenu();
     if (searchTypeDropDownList.SelectedIndex == 0) {
         menu.MenuItems.Add(new OwnerDrawMenuItem(". Any single character", -1, new EventHandler(menuItem_Click), Shortcut.None, "."));
         menu.MenuItems.Add(new OwnerDrawMenuItem("* Zero or more", -1, new EventHandler(menuItem_Click), Shortcut.None, "*"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("+ One or more", -1, new EventHandler(menuItem_Click), Shortcut.None, "+"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("-"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("^ Beginning of line", -1, new EventHandler(menuItem_Click), Shortcut.None, "^"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("$ End of line", -1, new EventHandler(menuItem_Click), Shortcut.None, "$"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("\\b Word boundary", -1, new EventHandler(menuItem_Click), Shortcut.None, "\\b"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("\\s Whitespace", -1, new EventHandler(menuItem_Click), Shortcut.None, "\\s"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("\\n Line break", -1, new EventHandler(menuItem_Click), Shortcut.None, "\\n"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("-"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("[ ] Any one character in the set", -1, new EventHandler(menuItem_Click), Shortcut.None, "[ ]"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("[^ ] Any one character not in the set", -1, new EventHandler(menuItem_Click), Shortcut.None, "[^ ]"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("| Or", -1, new EventHandler(menuItem_Click), Shortcut.None, "|"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("\\ Escape special character", -1, new EventHandler(menuItem_Click), Shortcut.None, "\\"));
     }
     else {
         menu.MenuItems.Add(new OwnerDrawMenuItem("* Zero or more of any character", -1, new EventHandler(menuItem_Click), Shortcut.None, "*"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("? Any single character", -1, new EventHandler(menuItem_Click), Shortcut.None, "?"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("# Any single digit", -1, new EventHandler(menuItem_Click), Shortcut.None, "#"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("[ ] Any one character in the set", -1, new EventHandler(menuItem_Click), Shortcut.None, "[ ]"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("[! ] Any one character not in the set", -1, new EventHandler(menuItem_Click), Shortcut.None, "[! ]"));
     }
     menu.Show(findInsertButton, new Point(findInsertButton.ClientRectangle.Right, findInsertButton.ClientRectangle.Top));
 }
 /// <summary>
 /// Occurs when the button is clicked.
 /// </summary>
 /// <param name="sender">Sender of the event.</param>
 /// <param name="e">Event arguments.</param>
 private void findInsertButton_Click(object sender, System.EventArgs e)
 {
     OwnerDrawContextMenu menu = new OwnerDrawContextMenu();
     if (searchTypeDropDownList.SelectedIndex == 0)
     {
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_SingleCharacter"), -1, new EventHandler(menuItem_Click), Shortcut.None, "."));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_ZeroOrMore"), -1, new EventHandler(menuItem_Click), Shortcut.None, "*"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_OneOrMore"), -1, new EventHandler(menuItem_Click), Shortcut.None, "+"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("-"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_BeginningOfLine"), -1, new EventHandler(menuItem_Click), Shortcut.None, "^"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_EndOfLine"), -1, new EventHandler(menuItem_Click), Shortcut.None, "$"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_WordBoundary"), -1, new EventHandler(menuItem_Click), Shortcut.None, "\\b"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_Whitespace"), -1, new EventHandler(menuItem_Click), Shortcut.None, "\\s"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_LineBreak"), -1, new EventHandler(menuItem_Click), Shortcut.None, "\\n"));
         menu.MenuItems.Add(new OwnerDrawMenuItem("-"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_OneCharacterInSet"), -1, new EventHandler(menuItem_Click), Shortcut.None, "[ ]"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_OneCharacterNotInSet"), -1, new EventHandler(menuItem_Click), Shortcut.None, "[^ ]"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_Or"), -1, new EventHandler(menuItem_Click), Shortcut.None, "|"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_CharacterEscape"), -1, new EventHandler(menuItem_Click), Shortcut.None, "\\"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_RegularExpression_Group"), -1, new EventHandler(menuItem_Click), Shortcut.None, "( )"));
     }
     else
     {
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_ZeroOrMore"), -1, new EventHandler(menuItem_Click), Shortcut.None, "*"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_AnySingleCharacter"), -1, new EventHandler(menuItem_Click), Shortcut.None, "?"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_AnySingleDigit"), -1, new EventHandler(menuItem_Click), Shortcut.None, "#"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_OneCharacterInSet"), -1, new EventHandler(menuItem_Click), Shortcut.None, "[ ]"));
         menu.MenuItems.Add(new OwnerDrawMenuItem(AssemblyInfo.Instance.Resources.GetString("FindReplaceForm_Wildcard_OneCharacterNotInSet"), -1, new EventHandler(menuItem_Click), Shortcut.None, "[! ]"));
     }
     menu.Show(findInsertButton, new Point(findInsertButton.ClientRectangle.Right, findInsertButton.ClientRectangle.Top));
 }