예제 #1
0
        private void Activate()
        {
            if (Items.Count == 0 || !Enabled)
            {
                return;
            }

            customdropdown = new ExtListBoxForm(this.Name);

            customdropdown.SelectionBackColor       = this.DropDownBackgroundColor;
            customdropdown.MouseOverBackgroundColor = this.MouseOverBackgroundColor;
            customdropdown.ForeColor            = this.ForeColor;
            customdropdown.BackColor            = this.BorderColor;
            customdropdown.BorderColor          = this.BorderColor;
            customdropdown.Items                = this.Items.ToList();
            customdropdown.SelectedIndex        = this.SelectedIndex;
            customdropdown.FlatStyle            = this.FlatStyle;
            customdropdown.Font                 = this.Font;
            customdropdown.ScrollBarColor       = this.ScrollBarColor;
            customdropdown.ScrollBarButtonColor = this.ScrollBarButtonColor;
            customdropdown.PositionBelow(this);

            customdropdown.Activated            += customdropdown_Activated;
            customdropdown.SelectedIndexChanged += customdropdown_SelectedIndexChanged;
            customdropdown.OtherKeyPressed      += customdropdown_OtherKeyPressed;
            customdropdown.Deactivate           += customdropdown_Deactivate;

            customdropdown.Show(FindForm());
        }
        private void AutoCompleteFinished()
        {
            //System.Diagnostics.Debug.WriteLine("{0} Show results {1}", Environment.TickCount % 10000, autocompletestrings.Count);
            executingautocomplete = false;

            int count = autocompletestrings.Count;

            if (count > 0)
            {
                if (cbdropdown != null && (autocompletelastcount < count || autocompletelastcount > count + 5))
                {                               // close if the counts are wildly different
                    cbdropdown.Close();
                    cbdropdown.Dispose();
                    cbdropdown = null;
                }

                if (cbdropdown == null)
                {
                    cbdropdown = new ExtListBoxForm("", false);

                    cbdropdown.SelectionBackColor = this.DropDownBackgroundColor;
                    cbdropdown.ForeColor          = this.ForeColor;
                    cbdropdown.BackColor          = this.DropDownBorderColor;
                    cbdropdown.BorderColor        = this.DropDownBorderColor;
                    cbdropdown.Items                    = autocompletestrings.ToList();
                    cbdropdown.SelectedIndex            = 0;
                    cbdropdown.FlatStyle                = this.FlatStyle;
                    cbdropdown.Font                     = this.Font;
                    cbdropdown.ScrollBarColor           = this.DropDownScrollBarColor;
                    cbdropdown.ScrollBarButtonColor     = this.DropDownScrollBarButtonColor;
                    cbdropdown.MouseOverBackgroundColor = this.DropDownMouseOverBackgroundColor;
                    cbdropdown.SelectedIndexChanged    += cbdropdown_SelectedIndexChanged;
                    cbdropdown.PositionBelow(this);
                    EndButtonImage = Properties.Resources.ArrowUp;
                    cbdropdown.Show(FindForm());
                    Focus();                // Major change.. we now keep the focus at all times

                    if (Environment.OSVersion.Platform != PlatformID.Win32NT)
                    {
                        cbdropdown.Activated += cbdropdown_Activated;
                    }
                }
                else
                {
                    cbdropdown.Items.Clear();
                    cbdropdown.Items = autocompletestrings.ToList();
                    cbdropdown.Refresh();
                }

                autocompletelastcount = count;
            }
            else
            {
                CancelAutoComplete();
            }
        }
예제 #3
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);
            if (e.X >= Width - SelectionSize && e.Y >= Height - SelectionSize)
            {
                if (dropdown == false)
                {
                    ddc.PositionBelow(this, this.Width);
                    ddc.RightAlignedToLocation = true;
                    System.Diagnostics.Debug.WriteLine("dcc border " + ddc.BorderColor);
                    ddc.Show(FindForm());
                }
                else
                {
                    ddc.Hide();
                }

                dropdown = !dropdown;
            }
        }
예제 #4
0
        private void drawnPanelListSelection_Click(object sender, EventArgs e)
        {
            autofadeinouttimer.Stop();      // in case we are in an autofade

            dropdown = new ExtListBoxForm("", true);

            dropdown.SelectionBackColor       = this.DropDownBackgroundColor;
            dropdown.ForeColor                = this.ForeColor;
            dropdown.BackColor                = this.DropDownBorderColor;
            dropdown.BorderColor              = this.DropDownBorderColor;
            dropdown.ScrollBarColor           = this.DropDownScrollBarColor;
            dropdown.ScrollBarButtonColor     = this.DropDownScrollBarButtonColor;
            dropdown.MouseOverBackgroundColor = this.DropDownMouseOverBackgroundColor;
            dropdown.ItemSeperatorColor       = this.DropDownItemSeperatorColor;

            dropdown.Font           = Font;
            dropdown.Items          = TextList.ToList();
            dropdown.ItemSeperators = ListSelectionItemSeparators;
            dropdown.ImageItems     = ImageList.ToList();
            dropdown.FlatStyle      = FlatStyle.Popup;
            dropdown.PositionBelow(pimageListSelection);

            dropdown.SelectedIndexChanged += (s, ea) =>
            {
                tdm = TabDisplayMode.Expanded;              // deactivate drop down.. leave in expanded mode
                ChangePanel(dropdown.SelectedIndex);
            };

            dropdown.Deactivate += (s, ea) =>               // will also be called on selected index because we have auto close on (in constructor)
            {
                tdm = TabDisplayMode.Expanded;              // deactivate drop down.. leave in expanded mode
                MouseLeavePanelObjects(sender, e);          // same as a mouse leave on one of the controls
            };

            dropdown.Show(this.FindForm());
            tdm = TabDisplayMode.ExpandedInList;            // hold display in here during list presentation
        }