コード例 #1
0
        /// <summary>
        /// Attach the helper to a textbox
        /// </summary>
        /// <param name="textBox"></param>
        /// <param name="enableDeselectOnEsc"></param>
        /// <param name="enableShowListOnRightclick"></param>
        /// <param name="enableTooltip"></param>
        /// <param name="columnHeaders"></param>
        /// <param name="items"></param>
        /// <param name="viewMode"></param>
        /// <param name="postSetFunc"></param>
        public static void AttachTextBox(TextBox textBox, bool enableDeselectOnEsc, bool enableShowListOnRightclick, bool enableTooltip, string[] columnHeaders, EnhancedTextBoxHelper.Items[] items, EnhancedTextBoxHelperList.ViewMode viewMode, Action postSetFunc)
        {
            CleanLists();

            if (textBox == null)
            {
                return;
            }

            UpdateItems(textBox, items, true);

            if (enableDeselectOnEsc)
            {
                SetDeselectOnEsc(textBox);
            }

            if (enableShowListOnRightclick && columnHeaders != null)
            {
                SetShowListOnRightClick(textBox, columnHeaders, viewMode, postSetFunc, true);
            }

            if (enableTooltip)
            {
                SetToolTipOnMouseOver(textBox);
            }
        }
コード例 #2
0
        /// <summary>
        /// Default attached event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="columnHeaders"></param>
        /// <param name="viewMode"></param>
        /// <param name="postSetFunc"></param>
        private static void textBox_MouseDown(object sender, MouseEventArgs e, string[] columnHeaders, EnhancedTextBoxHelperList.ViewMode viewMode, Action postSetFunc)
        {
            if (e.Button == MouseButtons.Right)
            {
                TextBox textBox = (TextBox)sender;
                EnhancedTextBoxHelper.Items[] items = GetItems(textBox);

                if (textBox != null && items != null)
                {
                    if (textBox.Enabled && !textBox.ReadOnly)
                    {
                        textBox.Focus();
                        EnhancedTextBoxHelperList enhancedTextBoxHelperList = new EnhancedTextBoxHelperList(textBox, columnHeaders, items, textBox.Text, viewMode, postSetFunc);
                        enhancedTextBoxHelperList.ShowDialog();
                    }
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Attach the helper to a textbox, set the view mode, deselect enabled, showlist enabled, tooltip enabled
 /// </summary>
 /// <param name="textBox"></param>
 /// <param name="columnHeaders"></param>
 /// <param name="items"></param>
 /// <param name="viewMode"></param>
 public static void AttachTextBox(TextBox textBox, string[] columnHeaders, EnhancedTextBoxHelper.Items[] items, EnhancedTextBoxHelperList.ViewMode viewMode)
 {
     AttachTextBox(textBox, true, true, true, columnHeaders, items, viewMode, null);
 }
コード例 #4
0
 /// <summary>
 /// Attache the show list on right click event
 /// </summary>
 /// <param name="textBox"></param>
 /// <param name="columnHeaders"></param>
 /// <param name="viewMode"></param>
 /// <param name="postSetFunc"></param>
 /// <param name="drawInfoicon"></param>
 private static void SetShowListOnRightClick(TextBox textBox, string[] columnHeaders, EnhancedTextBoxHelperList.ViewMode viewMode, Action postSetFunc, bool drawInfoicon)
 {
     if (textBox != null)
     {
         if (!_attached_MouseDown.ContainsKey(textBox))
         {
             _attached_MouseDown.Add(textBox, new MouseEventHandler((sender, e) => textBox_MouseDown(sender, e, columnHeaders, viewMode, postSetFunc)));
             if (drawInfoicon && textBox.Parent != null)
             {
                 textBox.Parent.Paint += new PaintEventHandler((sender, e) => textBox_PaintInfoicon(sender, e, textBox));
             }
         }
         else
         {
             textBox.MouseDown           -= _attached_MouseDown[textBox];
             _attached_MouseDown[textBox] = new MouseEventHandler((sender, e) => textBox_MouseDown(sender, e, columnHeaders, viewMode, postSetFunc));
         }
         textBox.MouseDown += _attached_MouseDown[textBox];
     }
 }
コード例 #5
0
 /// <summary>
 /// Attach the helper to a textbox, set the view mode, deselect enabled, showlist enabled, tooltip enabled
 /// </summary>
 /// <param name="textBox"></param>
 /// <param name="columnHeaders"></param>
 /// <param name="items"></param>
 /// <param name="viewMode"></param>
 /// <param name="postSetFunc"></param>
 public static void AttachTextBox(TextBox textBox, string[] columnHeaders, EnhancedTextBoxHelper.Items[] items, EnhancedTextBoxHelperList.ViewMode viewMode, Action postSetFunc)
 {
     AttachTextBox(textBox, true, true, true, columnHeaders, items, viewMode, postSetFunc);
 }