Example #1
0
 public ExtPanelDropDown()
 {
     InitializeComponent();
     ddc = new ExtListBoxForm("PSDD", false);
     ddc.SelectedIndexChanged += Ddc_SelectedIndexChanged;
     ddc.Deactivate           += Ddc_Deactivate;
 }
Example #2
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();
            }
        }
Example #4
0
        private void Activate()
        {
            if (Items.Count == 0 || !Enabled)
            {
                return;
            }

            _customdropdown = new ExtListBoxForm(this.Name);

            int fittableitems = this.DropDownHeight / this.ItemHeight;

            if (fittableitems == 0)
            {
                fittableitems = 5;
            }

            if (fittableitems > this.Items.Count())                             // no point doing more than we have..
            {
                fittableitems = this.Items.Count();
            }

            _customdropdown.Size = new Size(this.DropDownWidth > 9 ? this.DropDownWidth : this.Width, fittableitems * this.ItemHeight + 4);

            _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.ItemHeight           = this.ItemHeight;
            _customdropdown.SelectedIndex        = this.SelectedIndex;
            _customdropdown.FlatStyle            = this.FlatStyle;
            _customdropdown.Font                 = this.Font;
            _customdropdown.ScrollBarColor       = this.ScrollBarColor;
            _customdropdown.ScrollBarButtonColor = this.ScrollBarButtonColor;

            _customdropdown.Activated            += _customdropdown_DropDown;
            _customdropdown.SelectedIndexChanged += _customdropdown_SelectedIndexChanged;
            _customdropdown.OtherKeyPressed      += _customdropdown_OtherKeyPressed;
            _customdropdown.Deactivate           += _customdropdown_Deactivate;

            _customdropdown.Show(FindForm());

            // enforce size.. some reason SHow is scaling it probably due to autosizing.. can't turn off. force back
            _customdropdown.Size = new Size(this.DropDownWidth > 9 ? this.DropDownWidth : this.Width, fittableitems * this.ItemHeight + 4);
        }
Example #5
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.ItemHeight     = ImageList[0].Size.Height + 2;
            dropdown.Items          = TextList.ToList();
            dropdown.ItemSeperators = ListSelectionItemSeparators;
            dropdown.ImageItems     = ImageList.ToList();
            dropdown.FlatStyle      = FlatStyle.Popup;
            dropdown.Activated     += (s, ea) =>
            {
                Point location = panelListSelection.PointToScreen(new Point(0, 0));
                dropdown.Location = dropdown.PositionWithinScreen(location.X + panelListSelection.Width, location.Y);
                this.Invalidate(true);
            };
            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.Size = new Size(DropDownWidth, DropDownHeight);
            dropdown.Show(this.FindForm());
            tdm = TabDisplayMode.ExpandedInList;            // hold display in here during list presentation
        }
        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 = null;
                }

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

                    int fittableitems = this.DropDownHeight / this.DropDownItemHeight;

                    if (fittableitems == 0)
                    {
                        fittableitems = 5;
                    }

                    if (fittableitems > autocompletestrings.Count())                             // no point doing more than we have..
                    {
                        fittableitems = autocompletestrings.Count();
                    }

                    cbdropdown.Size = new Size(this.DropDownWidth > 0 ? this.DropDownWidth : this.Width, fittableitems * this.DropDownItemHeight + 4);

                    cbdropdown.SelectionBackColor = this.DropDownBackgroundColor;
                    cbdropdown.ForeColor          = this.ForeColor;
                    cbdropdown.BackColor          = this.DropDownBorderColor;
                    cbdropdown.BorderColor        = this.DropDownBorderColor;
                    cbdropdown.Items                    = autocompletestrings;
                    cbdropdown.ItemHeight               = this.DropDownItemHeight;
                    cbdropdown.SelectedIndex            = 0;
                    cbdropdown.FlatStyle                = this.FlatStyle;
                    cbdropdown.Font                     = this.Font;
                    cbdropdown.ScrollBarColor           = this.DropDownScrollBarColor;
                    cbdropdown.ScrollBarButtonColor     = this.DropDownScrollBarButtonColor;
                    cbdropdown.MouseOverBackgroundColor = this.DropDownMouseOverBackgroundColor;
                    cbdropdown.Activated               += cbdropdown_DropDown;
                    cbdropdown.SelectedIndexChanged    += cbdropdown_SelectedIndexChanged;

                    EndButtonImage = Properties.Resources.ArrowUp;
                    cbdropdown.Show(FindForm());
                    Focus();                // Major change.. we now keep the focus at all times
                }
                else
                {
                    cbdropdown.Items.Clear();
                    cbdropdown.Items = autocompletestrings;
                    cbdropdown.Refresh();
                }

                autocompletelastcount = count;
            }
            else
            {
                CancelAutoComplete();
            }
        }