public InputHtmlBuilderTests()
 {
     input = TextBoxBaseTestHelper.CreateInput<int>(null, null);
     renderer = new TextBoxBaseHtmlBuilder<int>(input);
     objectName = "t-integerinput";
     input.Name = "IntegerInput";
 }
Exemple #2
0
 private static int GetLineIndex(TextBoxBase txt, int line)
 {
     return(NativeMethods.SendMessageInt(txt.Handle, 0xbb, new IntPtr(line), IntPtr.Zero).ToInt32());
 }
Exemple #3
0
 /// <summary>
 ///   Initializes a new instance of the Selection class by associating it with a TextBoxBase derived object. </summary>
 /// <param name="textBox">
 ///   The TextBoxBase object for which the selection is being manipulated. </param>
 /// <seealso cref="System.Windows.Forms.TextBoxBase" />
 public Selection(TextBoxBase textBox)
 {
     m_textBox = textBox;
 }
Exemple #4
0
 /// <summary>
 ///   Initializes a new instance of the Saver class by associating it with a TextBoxBase derived object. </summary>
 /// <param name="textBox">
 ///   The TextBoxBase object for which the selection is being saved. </param>
 /// <remarks>
 ///   This constructor saves the textbox's start and end position of the selection inside private fields. </remarks>
 /// <seealso cref="System.Windows.Forms.TextBoxBase" />
 public Saver(TextBoxBase textBox)
 {
     m_textBox   = textBox;
     m_selection = new Selection(textBox);
     m_selection.Get(out m_start, out m_end);
 }
Exemple #5
0
 /// <summary>
 /// 销毁对象。
 /// </summary>
 public virtual void Dispose()
 {
     RemoveEventHandlers();
     m_textBox = null;
 }
Exemple #6
0
        /// <summary>
        /// 미리 저장된 Form의 위치와 크기 정보를 불러와서 현재 폼의 위치와 크기를 변경함.
        /// </summary>
        /// <param name="AppProductName">Application.ProductName</param>
        /// <param name="FrmOrUc">Form 개체</param>
        /// <param name="Kind">저장될 값의 종류</param>
        /// <example>
        /// 다음은 폼이 닫힐 때 폼의 위치, 크기 정보를 저장하고,
        /// 폼이 열릴 때 저장되었던 폼의 위치, 크기 정보를 불러와서 열린 폼에 적용합니다.
        /// <code>
        /// private void Form1_Load(object sender, System.EventArgs e)
        /// {
        ///	 CWinForm.RestoreFormStatus(Application.ProductName, this, FormSaveRestoreKind.SizePosition);
        /// }
        /// private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        /// {
        ///	 CWinForm.SaveFormStatus(Application.ProductName, this, FormSaveRestoreKind.SizePosition);
        /// }
        /// </code>
        /// </example>
        public static void RestoreFormStatus(string AppProductName, ContainerControl FrmOrUc, FormSaveRestoreKind Kind, CXmlConfig xc)
        {
            string FrmOrUcName = FrmOrUc.Name;
            string Section     = AppProductName + "\\" + FrmOrUcName;

            if ((Kind & FormSaveRestoreKind.SizePosition) == FormSaveRestoreKind.SizePosition)
            {
                Form frm = (Form)FrmOrUc;

                int LeftWill, TopWill;

                int    WindowStateDefault = (int)FormWindowState.Normal;
                object WindowState        =
                    (xc != null) ?
                    xc.GetSetting(FrmOrUcName + ".WindowState", WindowStateDefault) :
                    CRegistry.GetSetting(Section, "WindowState", WindowStateDefault);

                FormWindowState ws = FormWindowState.Normal;
                try { ws = (FormWindowState)Convert.ToInt32(WindowState); }
                catch (Exception) { }

                if (frm.WindowState != ws)
                {
                    frm.WindowState = ws;
                }

                if (ws == FormWindowState.Normal)
                {
                    int    LeftDefault = frm.Left;
                    object Left        =
                        (xc != null) ?
                        xc.GetSetting(FrmOrUcName + ".Left", LeftDefault) :
                        CRegistry.GetSetting(Section, "Left", LeftDefault);

                    LeftWill = Convert.ToInt32(Left);
                    if (LeftWill < 0)
                    {
                        LeftWill = 0;
                    }

                    int    TopDefault = frm.Top;
                    object Top        =
                        (xc != null) ?
                        xc.GetSetting(FrmOrUcName + ".Top", TopDefault) :
                        CRegistry.GetSetting(Section, "Top", TopDefault);

                    TopWill = Convert.ToInt32(Top);
                    if (TopWill < 0)
                    {
                        TopWill = 0;
                    }

                    if (frm.Left != LeftWill)
                    {
                        frm.Left = LeftWill;
                    }
                    if (frm.Top != TopWill)
                    {
                        frm.Top = TopWill;
                    }

                    switch (frm.FormBorderStyle)
                    {
                    case FormBorderStyle.Fixed3D:
                    case FormBorderStyle.FixedDialog:
                    case FormBorderStyle.FixedSingle:
                    case FormBorderStyle.FixedToolWindow:
                        break;

                    default:
                        int    WidthDefault = frm.Width;
                        object Width        =
                            (xc != null) ?
                            xc.GetSetting(FrmOrUcName + ".Width", WidthDefault) :
                            CRegistry.GetSetting(Section, "Width", WidthDefault);

                        int WidthWill = Convert.ToInt32(Width);
                        if (frm.Width != WidthWill)
                        {
                            frm.Width = WidthWill;
                        }

                        int    HeightDefault = frm.Height;
                        object Height        =
                            (xc != null) ?
                            xc.GetSetting(FrmOrUcName + ".Height", HeightDefault) :
                            CRegistry.GetSetting(Section, "Height", HeightDefault);

                        int HeightWill = Convert.ToInt32(Height);
                        if (frm.Height != HeightWill)
                        {
                            frm.Height = HeightWill;
                        }

                        break;
                    }
                }
            }

            if (((Kind & FormSaveRestoreKind.TextBox) == FormSaveRestoreKind.TextBox) ||
                ((Kind & FormSaveRestoreKind.NumericUpDown) == FormSaveRestoreKind.NumericUpDown) ||
                ((Kind & FormSaveRestoreKind.ListControl) == FormSaveRestoreKind.ListControl) ||
                ((Kind & FormSaveRestoreKind.CheckBox) == FormSaveRestoreKind.CheckBox))
            {
                List <Control> aCtl = new List <Control>();
                aCtl = GetControls(FrmOrUc, ref aCtl);

                foreach (Control ctl in aCtl)
                {
                    Type TypeCur = ctl.GetType();

                    string ControlName = ctl.Name;

                    if (((Kind & FormSaveRestoreKind.TextBox) == FormSaveRestoreKind.TextBox) && (TypeCur.BaseType == typeof(TextBoxBase)))
                    {
                        TextBoxBase txt = (TextBoxBase)ctl;

                        string Value =
                            (xc != null) ?
                            xc.GetSetting(FrmOrUcName + "." + ControlName, txt.Text) :
                            CRegistry.GetSetting(Section, ControlName, txt.Text).ToString();

                        if (txt.Text != Value)
                        {
                            txt.Text = Value;
                        }
                    }
                    else if (((Kind & FormSaveRestoreKind.NumericUpDown) == FormSaveRestoreKind.NumericUpDown) && (TypeCur == typeof(NumericUpDown)))
                    {
                        NumericUpDown nud = (NumericUpDown)ctl;

                        string Value =
                            (xc != null) ?
                            xc.GetSetting(FrmOrUcName + "." + ControlName, nud.Value) :
                            CRegistry.GetSetting(Section, ControlName, nud.Value).ToString();

                        if (nud.Value.ToString() != Value)
                        {
                            nud.Value = (decimal)CFindRep.IfNotNumberThen0Decimal(Value);
                        }
                    }
                    else if (((Kind & FormSaveRestoreKind.ListControl) == FormSaveRestoreKind.ListControl) && (TypeCur.BaseType == typeof(ListControl)))
                    {
                        ListControl lst = (ListControl)ctl;
                        RestoreListControlSelectedIndex(Application.ProductName, FrmOrUc, lst, xc);
                    }
                    else if (((Kind & FormSaveRestoreKind.CheckBox) == FormSaveRestoreKind.CheckBox) && (TypeCur == typeof(CheckBox)))
                    {
                        CheckBox chk = (CheckBox)ctl;

                        bool Checked =
                            (xc != null) ?
                            (xc.GetSetting(FrmOrUcName + "." + ControlName, CFindRep.IfTrueThen1FalseThen0(chk.Checked)) == "1") :
                            (CRegistry.GetSetting(Section, ControlName, CFindRep.IfTrueThen1FalseThen0(chk.Checked)).ToString() == "1");

                        if (chk.Checked != Checked)
                        {
                            chk.Checked = Checked;
                        }
                    }
                    else if (((Kind & FormSaveRestoreKind.RadioButton) == FormSaveRestoreKind.RadioButton) && (TypeCur == typeof(RadioButton)))
                    {
                        RadioButton rad = (RadioButton)ctl;

                        bool Checked =
                            (xc != null) ?
                            (xc.GetSetting(FrmOrUcName + "." + ControlName, CFindRep.IfTrueThen1FalseThen0(rad.Checked)) == "1") :
                            (CRegistry.GetSetting(Section, ControlName, CFindRep.IfTrueThen1FalseThen0(rad.Checked)).ToString() == "1");

                        if (rad.Checked != Checked)
                        {
                            rad.Checked = Checked;
                        }
                    }
                }
            }
        }
Exemple #7
0
 private static void AppendTextBox(TextBoxBase textBox, string message)
 {
     textBox.AppendText(message);
 }
Exemple #8
0
 public static void AppendTextLine(this TextBoxBase textbox)
 {
     textbox.AppendText("\n");
 }
Exemple #9
0
 public static IObservable <EventPattern <MouseButtonEventArgs> > MouseDownObserver(this TextBoxBase This)
 {
     return(Observable.FromEventPattern <MouseButtonEventHandler, MouseButtonEventArgs>(h => This.MouseDown += h, h => This.MouseDown -= h));
 }
Exemple #10
0
 public static IObservable <EventPattern <ContextMenuEventArgs> > ContextMenuClosingObserver(this TextBoxBase This)
 {
     return(Observable.FromEventPattern <ContextMenuEventHandler, ContextMenuEventArgs>(h => This.ContextMenuClosing += h, h => This.ContextMenuClosing -= h));
 }
Exemple #11
0
 public static IObservable <EventPattern <ToolTipEventArgs> > ToolTipClosingObserver(this TextBoxBase This)
 {
     return(Observable.FromEventPattern <ToolTipEventHandler, ToolTipEventArgs>(h => This.ToolTipClosing += h, h => This.ToolTipClosing -= h));
 }
Exemple #12
0
 public static IObservable <EventPattern <RoutedEventArgs> > UnloadedObserver(this TextBoxBase This)
 {
     return(Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(h => This.Unloaded += h, h => This.Unloaded -= h));
 }
Exemple #13
0
 public static IObservable <EventPattern <EventArgs> > InitializedObserver(this TextBoxBase This)
 {
     return(Observable.FromEventPattern <EventHandler, EventArgs>(h => This.Initialized += h, h => This.Initialized -= h));
 }
 public TextBoxBaseTests()
 {
     viewContext = TestHelper.CreateViewContext();
     input = TextBoxBaseTestHelper.CreateInput<int>(null, viewContext);
 }
Exemple #15
0
        private void OnTextBoxTextChanged(TextBoxBase control)
        {
            var box = (InputBox)control.Tag;

            box.Value = control.Text;
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        // Ctor.
        internal SpellCheck(TextBoxBase owner)
        {
            _owner = owner;
        }
Exemple #17
0
 public static void SetIncludeSpellingSuggestions(TextBoxBase element, bool value) => element.SetValue(IncludeSpellingSuggestionsProperty, value);
Exemple #18
0
 public TextBoxOutput(TextBoxBase textBox)
 {
     this.textBox = textBox;
 }
Exemple #19
0
 public static bool GetIncludeSpellingSuggestions(TextBoxBase element) => (bool)element.GetValue(IncludeSpellingSuggestionsProperty);
 public static void FocusAndSelectAll(this TextBoxBase control)
 {
     control.Focus();
     control.SelectAll();
 }
Exemple #21
0
 public TextBoxTraceListener(TextBoxBase output, int logMaxLine)
 {
     this.Name   = "Trace";
     this.output = output;
     _logMaxLine = logMaxLine;
 }
Exemple #22
0
        /// <summary>
        /// Form의 위치와 크기 정보를 다음에 불러올 수 있도록 레지스트리에 저장함.
        /// </summary>
        /// <param name="AppProductName">Application.ProductName</param>
        /// <param name="FrmOrUc">Form 개체</param>
        /// <param name="Kind">저장될 값의 종류</param>
        /// <example>
        /// 다음은 폼이 닫힐 때 폼의 위치, 크기 정보를 저장하고,
        /// 폼이 열릴 때 저장되었던 폼의 위치, 크기 정보를 불러와서 열린 폼에 적용합니다.
        /// <code>
        /// private void Form1_Load(object sender, System.EventArgs e)
        /// {
        ///	 CWinForm.RestoreFormStatus(Application.ProductName, this, FormSaveRestoreKind.SizePosition);
        /// }
        /// private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        /// {
        ///	 CWinForm.SaveFormStatus(Application.ProductName, this, FormSaveRestoreKind.SizePosition);
        /// }
        /// </code>
        /// </example>
        public static void SaveFormStatus(string AppProductName, ContainerControl FrmOrUc, FormSaveRestoreKind Kind, CXmlConfig xc)
        {
            string FrmOrUcName = FrmOrUc.Name;
            string Section     = AppProductName + "\\" + FrmOrUcName;

            if ((Kind & FormSaveRestoreKind.SizePosition) == FormSaveRestoreKind.SizePosition)
            {
                Form frm = (Form)FrmOrUc;

                if (xc != null)
                {
                    xc.SaveSetting(FrmOrUcName + ".WindowState", Convert.ToInt32(frm.WindowState));
                }
                else
                {
                    CRegistry.SaveSetting(Section, "WindowState", Convert.ToInt32(frm.WindowState));
                }

                if (frm.WindowState == FormWindowState.Normal)
                {
                    if (xc != null)
                    {
                        xc.SaveSetting(FrmOrUcName + ".Left", frm.Left);
                        xc.SaveSetting(FrmOrUcName + ".Top", frm.Top);
                    }
                    else
                    {
                        CRegistry.SaveSetting(Section, "Left", frm.Left);
                        CRegistry.SaveSetting(Section, "Top", frm.Top);
                    }

                    switch (frm.FormBorderStyle)
                    {
                    case FormBorderStyle.Fixed3D:
                    case FormBorderStyle.FixedDialog:
                    case FormBorderStyle.FixedSingle:
                    case FormBorderStyle.FixedToolWindow:
                        break;

                    default:
                        if (xc != null)
                        {
                            xc.SaveSetting(FrmOrUcName + ".Width", frm.Width);
                            xc.SaveSetting(FrmOrUcName + ".Height", frm.Height);
                        }
                        else
                        {
                            CRegistry.SaveSetting(Section, "Width", frm.Width);
                            CRegistry.SaveSetting(Section, "Height", frm.Height);
                        }
                        break;
                    }
                }
            }

            if (((Kind & FormSaveRestoreKind.TextBox) == FormSaveRestoreKind.TextBox) ||
                ((Kind & FormSaveRestoreKind.NumericUpDown) == FormSaveRestoreKind.NumericUpDown) ||
                ((Kind & FormSaveRestoreKind.ListControl) == FormSaveRestoreKind.ListControl) ||
                ((Kind & FormSaveRestoreKind.CheckBox) == FormSaveRestoreKind.CheckBox))
            {
                List <Control> aCtl = new List <Control>();
                aCtl = GetControls(FrmOrUc, ref aCtl);

                foreach (Control ctl in aCtl)
                {
                    Type TypeCur = ctl.GetType();

                    string ControlName = ctl.Name;

                    if (((Kind & FormSaveRestoreKind.TextBox) == FormSaveRestoreKind.TextBox) && (TypeCur.BaseType == typeof(TextBoxBase)))
                    {
                        TextBoxBase txt = (TextBoxBase)ctl;

                        if (xc != null)
                        {
                            xc.SaveSetting(FrmOrUcName + "." + ControlName, txt.Text);
                        }
                        else
                        {
                            CRegistry.SaveSetting(Section, ControlName, txt.Text);
                        }
                    }
                    else if (((Kind & FormSaveRestoreKind.NumericUpDown) == FormSaveRestoreKind.NumericUpDown) && (TypeCur == typeof(NumericUpDown)))
                    {
                        NumericUpDown nud = (NumericUpDown)ctl;

                        if (xc != null)
                        {
                            xc.SaveSetting(FrmOrUcName + "." + ControlName, nud.Value);
                        }
                        else
                        {
                            CRegistry.SaveSetting(Section, ControlName, nud.Value);
                        }
                    }
                    else if (((Kind & FormSaveRestoreKind.ListControl) == FormSaveRestoreKind.ListControl) && (TypeCur.BaseType == typeof(ListControl)))
                    {
                        ListControl lst = (ListControl)ctl;
                        SaveListControlSelectedIndex(AppProductName, FrmOrUc, lst, xc);
                    }
                    else if (((Kind & FormSaveRestoreKind.CheckBox) == FormSaveRestoreKind.CheckBox) && (TypeCur == typeof(CheckBox)))
                    {
                        CheckBox chk = (CheckBox)ctl;

                        if (xc != null)
                        {
                            xc.SaveSetting(FrmOrUcName + "." + ControlName, CFindRep.IfTrueThen1FalseThen0(chk.Checked));
                        }
                        else
                        {
                            CRegistry.SaveSetting(Section, ControlName, CFindRep.IfTrueThen1FalseThen0(chk.Checked));
                        }
                    }
                }
            }
        }
Exemple #23
0
        private static void SetFormattingRect(this TextBoxBase textbox, Rectangle rect)
        {
            var rc = new RECT(rect);

            SendMessage(textbox.Handle, EmSetrect, 0, ref rc);
        }
 public ControlWriter(TextBoxBase textbox)
 {
     this.textbox = textbox;
 }
Exemple #25
0
 public static CodeMenu Create <TEntry>(TextBoxBase tb, params TEntry[] ignoreList) where TEntry : CodeMenuEntry
 {
     return(Create(tb, ignoreList, (CodeMenuItem[])null));
 }
Exemple #26
0
 /// <summary>
 ///   Disables restoring of the textbox's selection when <see cref="Dispose" /> is called. </summary>
 /// <seealso cref="Dispose" />
 /// <seealso cref="Update" />
 public void Disable()
 {
     m_textBox = null;
 }
Exemple #27
0
        public CodeMenu(TextBoxBase tbb, CodeMenuItem[] items)
        {
            textBoxBase = tbb;

            Font            = new Font("Lucida Console", 8);
            AutoClose       = textBoxBase == null;
            ShowImageMargin = false;

            foreach (CodeMenuItem item in items)
            {
                ToolStripMenuItem tsmi = new ToolStripMenuItem {
                    Text = $"{item.Name} - {item.Description}", Tag = item.Name
                };

                tsmi.MouseUp += (sender, e) =>
                {
                    if (textBoxBase != null && e.Button == MouseButtons.Left)
                    {
                        string text = ((ToolStripMenuItem)sender).Tag.ToString();
                        textBoxBase.AppendTextToSelection(text);
                    }
                    else
                    {
                        Close();
                    }
                };

                if (string.IsNullOrWhiteSpace(item.Category))
                {
                    Items.Add(tsmi);
                }
                else
                {
                    ToolStripMenuItem tsmiParent;
                    int index = Items.IndexOfKey(item.Category);
                    if (index < 0)
                    {
                        tsmiParent = new ToolStripMenuItem {
                            Text = item.Category, Tag = item.Category, Name = item.Category
                        };
                        tsmiParent.HideImageMargin();
                        Items.Add(tsmiParent);
                    }
                    else
                    {
                        tsmiParent = Items[index] as ToolStripMenuItem;
                    }
                    tsmiParent.DropDownItems.Add(tsmi);
                }
            }

            Items.Add(new ToolStripSeparator());

            ToolStripMenuItem tsmiClose = new ToolStripMenuItem(Resources.CodeMenu_Create_Close);

            tsmiClose.Click += (sender, e) => Close();
            Items.Add(tsmiClose);

            if (ShareXResources.UseCustomTheme)
            {
                ShareXResources.ApplyCustomThemeToContextMenuStrip(this);
            }

            if (textBoxBase != null)
            {
                textBoxBase.MouseDown += (sender, e) =>
                {
                    if (Items.Count > 0)
                    {
                        Show(textBoxBase, MenuLocation);
                    }
                };

                textBoxBase.GotFocus += (sender, e) =>
                {
                    if (Items.Count > 0)
                    {
                        Show(textBoxBase, MenuLocation);
                    }
                };

                textBoxBase.LostFocus += (sender, e) =>
                {
                    if (Visible)
                    {
                        Close();
                    }
                };

                textBoxBase.KeyDown += (sender, e) =>
                {
                    if ((e.KeyCode == Keys.Enter || e.KeyCode == Keys.Escape) && Visible)
                    {
                        Close();
                        e.SuppressKeyPress = true;
                    }
                };

                textBoxBase.Disposed += (sender, e) => Dispose();
            }
        }
Exemple #28
0
 /// <summary>
 ///   Initializes a new instance of the Selection class by associating it with a TextBoxBase derived object.
 ///   and then selecting text on it. </summary>
 /// <param name="textBox">
 ///   The TextBoxBase object for which the selection is being manipulated. </param>
 /// <param name="start">
 ///   The zero-based position where to start the selection. </param>
 /// <param name="end">
 ///   The zero-based position where to end the selection.  If it's equal to the start position, no text is selected. </param>
 /// <seealso cref="System.Windows.Forms.TextBoxBase" />
 public Selection(TextBoxBase textBox, int start, int end)
 {
     m_textBox = textBox;
     Set(start, end);
 }
Exemple #29
0
 /// <summary>
 ///   Initializes a new instance of the MaskedBehavior class by associating it with a TextBoxBase derived object. </summary>
 /// <param name="textBox">
 ///   The TextBoxBase object to associate with this behavior.  It must not be null. </param>
 /// <exception cref="ArgumentNullException">textBox is null. </exception>
 /// <remarks>
 ///   This constructor sets the mask to an empty string, so that anything is allowed. </remarks>
 /// <seealso cref="Mask" />
 public MaskedBehavior(TextBoxBase textBox)
     :
     this(textBox, "")
 {
 }
 public QuickInsertMenuHandler(TextBoxBase targetControl, string text)
 {
     this.targetControl = targetControl;
     this.text          = text;
 }
Exemple #31
0
 public static void AppendTextLine(this TextBoxBase textbox, string text)
 {
     textbox.AppendText(text);
     textbox.AppendText("\n");
 }
Exemple #32
0
 public static void HideCaret(this TextBoxBase textBox, bool hide = true)
 => TextBoxExtender.StaticInstance.SetHideCaret(textBox, hide);
Exemple #33
0
    private void RegisterContextMenu(TextBoxBase control)
    {
        ContextMenu ContextMenu = new ContextMenu();
        if ((control != MainTextBox) && (control != SearchResultTextBox))
        {
            MenuItem EditUndoMenuItem = new MenuItem("Undo\t\tCtrl+Z");
            EditUndoMenuItem.Click += new EventHandler(MenuItem_Undo);
            ContextMenu.MenuItems.Add(EditUndoMenuItem);

            MenuItem MenuItemSeparator1 = new MenuItem("-");
            ContextMenu.MenuItems.Add(MenuItemSeparator1);

            MenuItem EditCutMenuItem = new MenuItem("Cut\t\tCtrl+X");
            EditCutMenuItem.Click += new EventHandler(MenuItem_Cut);
            ContextMenu.MenuItems.Add(EditCutMenuItem);

            MenuItem EditCopyMenuItem = new MenuItem("Copy\t\tCtrl+C");
            EditCopyMenuItem.Click += new EventHandler(MenuItem_Copy);
            ContextMenu.MenuItems.Add(EditCopyMenuItem);

            MenuItem EditPasteMenuItem = new MenuItem("Paste\t\tCtrl+V");
            EditPasteMenuItem.Click += new EventHandler(MenuItem_Paste);
            ContextMenu.MenuItems.Add(EditPasteMenuItem);

            MenuItem MenuItemSeparator2 = new MenuItem("-");
            ContextMenu.MenuItems.Add(MenuItemSeparator2);

            MenuItem EditSelectAllMenuItem = new MenuItem("Select All\tCtrl+A");
            EditSelectAllMenuItem.Click += new EventHandler(MenuItem_SelectAll);
            ContextMenu.MenuItems.Add(EditSelectAllMenuItem);
        }
        else
        {
            MenuItem EditCopyAllMenuItem = new MenuItem("Copy All\t\tCtrl+C");
            EditCopyAllMenuItem.Click += new EventHandler(MenuItem_Copy);
            ContextMenu.MenuItems.Add(EditCopyAllMenuItem);

            MenuItem MenuItemSeparator1 = new MenuItem("-");
            ContextMenu.MenuItems.Add(MenuItemSeparator1);

            MenuItem FindExactTextMenuItem = new MenuItem("Exact Text\tF5");
            FindExactTextMenuItem.Click += new EventHandler(MenuItem_ExactText);
            ContextMenu.MenuItems.Add(FindExactTextMenuItem);

            MenuItem FindSimilarWordsMenuItem = new MenuItem("Similar Words\tF6");
            FindSimilarWordsMenuItem.Click += new EventHandler(MenuItem_SimilarWords);
            ContextMenu.MenuItems.Add(FindSimilarWordsMenuItem);

            MenuItem FindRelatedWordsMenuItem = new MenuItem("Related Words\tF7");
            FindRelatedWordsMenuItem.Click += new EventHandler(MenuItem_RelatedWords);
            ContextMenu.MenuItems.Add(FindRelatedWordsMenuItem);

            MenuItem MenuItemSeparator2 = new MenuItem("-");
            ContextMenu.MenuItems.Add(MenuItemSeparator2);

            MenuItem FindSameValueMenuItem = new MenuItem("Same Value\tF9");
            FindSameValueMenuItem.Click += new EventHandler(MenuItem_SameValue);
            ContextMenu.MenuItems.Add(FindSameValueMenuItem);
        }

        ContextMenu.Popup += new EventHandler(ContextMenu_Popup);
        ContextMenu.Collapse += new EventHandler(ContextMenu_Collapse);

        control.ContextMenu = ContextMenu;
    }