IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Forms Discussion :

[c#] Utilisation "CodeCompletion"


Sujet :

Windows Forms

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2013
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2013
    Messages : 13
    Points : 8
    Points
    8
    Par défaut [c#] Utilisation "CodeCompletion"
    Bonjours,

    Je suis entrain de crée un Editor avec la base du "ICsharp.textEditor".
    Je souhaiterai ajouté un "CodeCompletion" mais je n'arrive pas
    Est-ce que quelqu'un pourrait m'aidé?

  2. #2
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2013
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Industrie

    Informations forums :
    Inscription : Mai 2013
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    Voila ce que j'ai essayer de faire mais sa ne marche pas vraiment... jai une erreur au niveau du "completionDataProvider" mais je voie pas comment je peu écrire cette classe quelqu'un aurait t-il une Idée??

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Forms;
    using System.IO;
    using System.Threading;
    using ICSharpCode.TextEditor;
    using ICSharpCode.TextEditor.Gui;
    using ICSharpCode.TextEditor.Gui.CompletionWindow;
    
    namespace Editor
    {
       class CodeCompletionKeyHandler 
        {
            FCentral mainForm;
            TextEditorControl editor;
            CodeCompletionWindow codeCompletionWindow;
    
    
            private CodeCompletionKeyHandler(FCentral mainForm, TextEditorControl editor)
            {
                this.mainForm = mainForm;
                this.editor = editor;
            }
            public static CodeCompletionKeyHandler Attach(FCentral 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;
            }
            /// <summary>
            /// Return true to handle the keypress, return false to let the text area handle the keypress
            /// </summary>
            bool TextAreaKeyEventHandler(char key)
            {
                if (codeCompletionWindow != null)
                {
                    // If completion window is open and wants to handle the key, don't let the text area
                    // handle it
                    if (codeCompletionWindow.ProcessKeyEvent(key))
                        return true;
                }
                if (key == '.')
                {
                    ICompletionDataProvider completionDataProvider = new CodeCompletionProvider(mainForm);
                    codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(
                    mainForm, // The parent window for the completion window
                    editor, // The text editor to show the window for
                    @"C:\Users\name.txt", // Filename - will be passed back to the provider
                    completionDataProvider, // Provider to get the list of possible completions
                    key // Key pressed - will be passed to the provider
                    );
                    if (codeCompletionWindow != null)
                    {
                        // ShowCompletionWindow can return null when the provider returns an empty list
                        codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow);
                    }
                }
                return false;
            }
            void CloseCodeCompletionWindow(object sender, EventArgs e)
            {
                if (codeCompletionWindow != null)
                {
                    codeCompletionWindow.Closed -= new EventHandler(CloseCodeCompletionWindow);
                    codeCompletionWindow.Dispose();
                    codeCompletionWindow = null;
                }
            }
    
            public ICompletionDataProvider completionDataProvider { get; set; }
       }
    
    }

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Utilisation du format $quote
    Par lhonolulu dans le forum SAS Base
    Réponses: 5
    Dernier message: 25/05/2009, 11h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo