protected override bool ProcessTextAreaKey(Keys keyData)
        {
            if (!Visible)
            {
                return(false);
            }

            switch (keyData)
            {
            case Keys.Home:
                codeCompletionListView.SelectIndex(0);
                return(true);

            case Keys.End:
                codeCompletionListView.SelectIndex(completionData.Length - 1);
                return(true);

            case Keys.PageDown:
                codeCompletionListView.PageDown();
                return(true);

            case Keys.PageUp:
                codeCompletionListView.PageUp();
                return(true);

            case Keys.Down:
                codeCompletionListView.SelectNextItem();
                return(true);

            case Keys.Up:
                codeCompletionListView.SelectPrevItem();
                return(true);

            case Keys.Tab:
                InsertSelectedItem('\t');
                return(true);

            case Keys.Return:
                InsertSelectedItem('\n');
                return(true);
            }

            return(base.ProcessTextAreaKey(keyData));
        }
        private CodeCompletionWindow(ICompletionDataProvider completionDataProvider, ICompletionData[] completionData,
                                     Form parentForm, TextEditorControl control, bool showDeclarationWindow, bool fixedListViewWidth) : base(
                parentForm, control)
        {
            dataProvider               = completionDataProvider;
            this.completionData        = completionData;
            document                   = control.Document;
            this.showDeclarationWindow = showDeclarationWindow;
            this.fixedListViewWidth    = fixedListViewWidth;

            workingScreen = Screen.GetWorkingArea(Location);
            startOffset   = control.ActiveTextAreaControl.Caret.Offset + 1;
            endOffset     = startOffset;
            if (completionDataProvider.PreSelection != null)
            {
                startOffset -= completionDataProvider.PreSelection.Length + 1;
                endOffset--;
            }

            codeCompletionListView                      = new CodeCompletionListView(completionData);
            codeCompletionListView.ImageList            = completionDataProvider.ImageList;
            codeCompletionListView.Dock                 = DockStyle.Fill;
            codeCompletionListView.SelectedItemChanged += CodeCompletionListViewSelectedItemChanged;
            codeCompletionListView.DoubleClick         += CodeCompletionListViewDoubleClick;
            codeCompletionListView.Click               += CodeCompletionListViewClick;
            Controls.Add(codeCompletionListView);

            if (completionData.Length > MaxListLength)
            {
                vScrollBar.Name        = "scroll";
                vScrollBar.Dock        = DockStyle.Right;
                vScrollBar.Minimum     = 0;
                vScrollBar.Maximum     = completionData.Length - 1;
                vScrollBar.SmallChange = 1;
                vScrollBar.LargeChange = MaxListLength;
                codeCompletionListView.FirstItemChanged += CodeCompletionListViewFirstItemChanged;
                Controls.Add(vScrollBar);
            }

            drawingSize = GetListViewSize();
            SetLocation();

            if (declarationViewWindow == null)
            {
                declarationViewWindow = new DeclarationViewWindow(parentForm);
            }
            SetDeclarationViewLocation();
            declarationViewWindow.ShowDeclarationViewWindow();
            declarationViewWindow.MouseMove += ControlMouseMove;
            control.Focus();
            CodeCompletionListViewSelectedItemChanged(this, EventArgs.Empty);

            if (completionDataProvider.DefaultIndex >= 0)
            {
                codeCompletionListView.SelectIndex(completionDataProvider.DefaultIndex);
            }

            if (completionDataProvider.PreSelection != null)
            {
                CaretOffsetChanged(this, EventArgs.Empty);
            }

            vScrollBar.ValueChanged           += VScrollBarValueChanged;
            document.DocumentAboutToBeChanged += DocumentAboutToBeChanged;
        }