protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     Dispose();
     codeCompletionListView.Dispose();
     codeCompletionListView = null;
     declarationViewWindow.Dispose();
     declarationViewWindow = null;
 }
        CodeCompletionWindow(ICompletionDataProvider completionDataProvider, Form parentForm, TextEditorControl control, string fileName) : base(parentForm, control, fileName)
        {
            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 += new EventHandler(CodeCompletionListViewSelectedItemChanged);
            codeCompletionListView.DoubleClick         += new EventHandler(CodeCompletionListViewDoubleClick);
            codeCompletionListView.Click               += new EventHandler(CodeCompletionListViewClick);
            Controls.Add(codeCompletionListView);

            if (completionData.Length > 10)
            {
                vScrollBar.Dock        = DockStyle.Right;
                vScrollBar.Minimum     = 0;
                vScrollBar.Maximum     = completionData.Length - 8;
                vScrollBar.SmallChange = 1;
                vScrollBar.LargeChange = 3;
                codeCompletionListView.FirstItemChanged += new EventHandler(CodeCompletionListViewFirstItemChanged);
                Controls.Add(vScrollBar);
            }

            this.drawingSize = new Size(codeCompletionListView.ItemHeight * 10, codeCompletionListView.ItemHeight * Math.Min(10, completionData.Length));
            SetLocation();

            declarationViewWindow = new DeclarationViewWindow(parentForm);
            SetDeclarationViewLocation();
            declarationViewWindow.ShowDeclarationViewWindow();
            control.Focus();
            CodeCompletionListViewSelectedItemChanged(this, EventArgs.Empty);
            if (completionDataProvider.PreSelection != null)
            {
                CaretOffsetChanged(this, EventArgs.Empty);
            }

            vScrollBar.Scroll += new ScrollEventHandler(DoScroll);
        }