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

MFC Discussion :

Retour chariot


Sujet :

MFC

  1. #1
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2003
    Messages
    88
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2003
    Messages : 88
    Points : 73
    Points
    73
    Par défaut Retour chariot
    Hello!!!
    J'ai un controle List Box auqul j'ajoute des items comme ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    SendDlgItemMessage(hwnd, IDC_CHAT_LIST_TEXTE, LB_ADDSTRING, 0, (LPARAM)szMessage);
    Si je met dans szMessage "texte \n texte", dans mon list box, j'ai un carré.... Comment faire pour utiliser un retour chariot?

    Merci

    @++

    R@f

  2. #2
    Membre habitué Avatar de BertrandA
    Inscrit en
    Août 2003
    Messages
    170
    Détails du profil
    Informations forums :
    Inscription : Août 2003
    Messages : 170
    Points : 197
    Points
    197
    Par défaut
    Essaye ça : "\n\r" (CR + LF)

  3. #3
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2003
    Messages
    88
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2003
    Messages : 88
    Points : 73
    Points
    73
    Par défaut
    Salut!!!
    J'ai mis ca dans ma chaine mais maintenant, g deux pitits carrés...

    @++

    R@f

  4. #4
    kor
    kor est déconnecté
    Nouveau membre du Club
    Inscrit en
    Juillet 2003
    Messages
    46
    Détails du profil
    Informations forums :
    Inscription : Juillet 2003
    Messages : 46
    Points : 34
    Points
    34
    Par défaut
    Tu veux pas utiliser "m_lstColonne.InsertString( index, string);".
    Tu inseres une ligne à la fois, non?

  5. #5
    kor
    kor est déconnecté
    Nouveau membre du Club
    Inscrit en
    Juillet 2003
    Messages
    46
    Détails du profil
    Informations forums :
    Inscription : Juillet 2003
    Messages : 46
    Points : 34
    Points
    34
    Par défaut
    Tu veux pas utiliser "m_lstbox.InsertString( index, string);".
    Tu inseres une ligne à la fois, non?

  6. #6
    Rédacteur
    Avatar de farscape
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2003
    Messages
    9 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2003
    Messages : 9 055
    Points : 17 323
    Points
    17 323
    Par défaut
    un truc bete ta ligne est suffisamment haute pour x lignes (via SetItemHeight) ?


  7. #7
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2003
    Messages
    88
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2003
    Messages : 88
    Points : 73
    Points
    73
    Par défaut
    Hello!!!
    J'ai pas touché a cette propriété. Kelle valeur je dois mettre?

    Merci

    @++

    R@f

  8. #8
    Membre émérite
    Avatar de la drogue c'est mal
    Profil pro
    Inscrit en
    Novembre 2002
    Messages
    2 253
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2002
    Messages : 2 253
    Points : 2 747
    Points
    2 747
    Par défaut
    je suis pas certain que dans une listbox on puisse faire du multi ligne.

    A confirmer

  9. #9
    Rédacteur
    Avatar de farscape
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2003
    Messages
    9 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2003
    Messages : 9 055
    Points : 17 323
    Points
    17 323
    Par défaut
    Exemple d’initialisation sur le message OnSetFont de la combobox:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
        CDC* pDC=GetDC();
        pDC->SelectObject(GetFont());
        TEXTMETRIC tm;
        pDC->GetTextMetrics(&tm);
        m_nDefaultFontHeight=tm.tmHeight;
        ReleaseDC(pDC);    
     
        SendMessage(CB_SETITEMHEIGHT,(WPARAM)-1,m_nDefaultFontHeight+1);
    Pour x ligne on fera (m_nDefaultFontHeight +1)*x etc..
    Note il faut que le mode CBS_OWNERDRAWVARIABLE soit fixer.

    Il fort possible que tu soit oblige de reprendre la main sur le dessin de la ligne
    Voila le traitement standard :
    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
     
    MComboBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
    {
    	// TODO: Add your code to draw the specified item
     
        int nItem=GetCurSel();
        CString sText(_T(""));
     
        if(lpDrawItemStruct->itemID!=-1)
            nItem=lpDrawItemStruct->itemID;
     
        if(nItem!=-1)
            GetLBText(nItem,sText);
     
        BOOL bHighlight=(lpDrawItemStruct->itemState & (ODS_FOCUS | ODS_SELECTED));
        BOOL bFocus=(lpDrawItemStruct->itemState & ODS_FOCUS);
     
        CRect rect=lpDrawItemStruct->rcItem;
     
        // fill background
        ::FillRect(lpDrawItemStruct->hDC,rect, 
    		::GetSysColorBrush(!IsWindowEnabled() ? COLOR_3DFACE : 
    		(bHighlight ? COLOR_HIGHLIGHT : COLOR_WINDOW)));
     
    	if(!sText.IsEmpty())
    	{
    		if(bFocus)
    			::DrawFocusRect(lpDrawItemStruct->hDC,rect);
     
    	    // select font
    		::SelectObject(lpDrawItemStruct->hDC,(HFONT)SendMessage(WM_GETFONT,0,0));
     
    		// set text attributes
    		::SetBkMode(lpDrawItemStruct->hDC,TRANSPARENT);
     
    		if(bHighlight)
    			::SetTextColor(lpDrawItemStruct->hDC,
    				::GetSysColor(COLOR_HIGHLIGHTTEXT));
    		else if(IsWindowEnabled())
    			::SetTextColor(lpDrawItemStruct->hDC,
    				::GetSysColor(COLOR_WINDOWTEXT));
    		else 
    			::SetTextColor(lpDrawItemStruct->hDC,
    				::GetSysColor(COLOR_3DSHADOW));
     
    		rect.DeflateRect(1,1);
    		// draw the text 
    		::DrawText(lpDrawItemStruct->hDC,sText,sText.GetLength(),rect,
    			DT_LEFT|DT_VCENTER|DT_SINGLELINE);
    // mettre DT_WORDBREAK à la place de DT_VCENTER|DT_SINGLELINE
    	}
    }
     
    // après il faut reprendre la main sur les notifications :
    BOOL MComboBox::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult) 
    {
    	// TODO: Add your specialized code here and/or call the base class
    	switch (message)
        {
        case WM_DRAWITEM:
            DrawItem((LPDRAWITEMSTRUCT)lParam);
            break;
    default:return CComboBox::OnChildNotify(message, wParam, lParam, pLResult);
        }
    return TRUE;	
    }

  10. #10
    Membre régulier
    Homme Profil pro
    Étudiant
    Inscrit en
    Octobre 2003
    Messages
    88
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Octobre 2003
    Messages : 88
    Points : 73
    Points
    73
    Par défaut
    Merci, vais essayer ca!

    @++

    R@f

Discussions similaires

  1. Retour chariot dans l'inspecteur d'objet
    Par All Jinx dans le forum Composants VCL
    Réponses: 3
    Dernier message: 20/10/2004, 01h28
  2. retour chariot GetWindowText
    Par johnlehardos dans le forum MFC
    Réponses: 2
    Dernier message: 29/01/2004, 21h20
  3. afficher texte avec retour chariot aprèq requète sql
    Par frenchy371 dans le forum Requêtes
    Réponses: 2
    Dernier message: 07/01/2004, 17h33
  4. retour chariot dans un string
    Par bono dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 29/12/2003, 12h17
  5. Retour chariot dans un TMemo ?
    Par Vincent PETIT dans le forum C++Builder
    Réponses: 7
    Dernier message: 27/08/2002, 18h55

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