public static CodeCompletionKeyHandler Attach(MainForm mainForm, TextEditorControl editor)
        {
            CodeCompletionKeyHandler h = new CodeCompletionKeyHandler(mainForm, editor);

            editor.ActiveTextAreaControl.TextArea.KeyEventHandler += h.TextAreaKeyEventHandler;

            // When the editor is disposed, close the code completion window
            editor.Disposed += h.CloseCodeCompletionWindow;

            return h;
        }
        public static CodeCompletionKeyHandler Attach(MainForm mainForm, TextEditorControl editor)
        {
            CodeCompletionKeyHandler h = new CodeCompletionKeyHandler(mainForm, editor);

            editor.ActiveTextAreaControl.TextArea.KeyEventHandler += h.TextAreaKeyEventHandler;

            // When the editor is disposed, close the code completion window
            editor.Disposed += h.CloseCodeCompletionWindow;

            return(h);
        }
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            string appPath = Path.GetDirectoryName(Application.ExecutablePath);

            this.sqlConnection1.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + quot + Data_Path + quot + ";Integrated Security=True;User Instance=False;Timeout=60";

            ICSharpCode.TextEditor.Document.FileSyntaxModeProvider provider = new ICSharpCode.TextEditor.Document.FileSyntaxModeProvider(appPath);
            ICSharpCode.TextEditor.Document.HighlightingManager.Manager.AddSyntaxModeFileProvider(provider);
            sqlEditor.Document.HighlightingStrategy = ICSharpCode.TextEditor.Document.HighlightingManager.Manager.FindHighlighter("SQL");


            sqlEditor.Text = @"SELECT word.lemma, synset.pos, synset.definition 
FROM word
LEFT JOIN sense ON word.wordid=sense.wordid
LEFT JOIN synset ON sense.synsetid=synset.synsetid
WHERE word.lemma='light'
ORDER BY synset.pos

";
//			sqlEditor.SetHighlighting("C#");
//			sqlEditor.SetHighlighting("SQL");
            sqlEditor.ShowEOLMarkers = false;
            CodeCompletionKeyHandler.Attach(this, sqlEditor);
            HostCallbackImplementation.Register(this);

            pcRegistry = new Dom.ProjectContentRegistry();             // Default .NET 2.0 registry

            // Persistence caches referenced project contents for faster loading.
            // It also activates loading XML documentation files and caching them
            // for faster loading and lower memory usage.
            pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(),
                                                        "CSharpCodeCompletion"));

            myProjectContent = new Dom.DefaultProjectContent();
            //myProjectContent.Language = Dom.LanguageProperties.CSharp;

            myProjectContent.Language = Dom.LanguageProperties.VBNet;
        }