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 :

[MFC] Drawtext vertical


Sujet :

MFC

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2006
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 56
    Points : 34
    Points
    34
    Par défaut [MFC] Drawtext vertical
    Salut,
    je cherche a écrire du texte dans un CDC verticalement C'est possible ?

    Sinon comment faire pour faire une rotation du CDC ?

    Merci

  2. #2
    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

  3. #3
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2006
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 56
    Points : 34
    Points
    34
    Par défaut
    Arf j'ai du mal avec la FAQ désolé ... je cherche jamais au bon endroit.
    Merci !

  4. #4
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2006
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 56
    Points : 34
    Points
    34
    Par défaut
    heu ca marche pas ...
    et dans l'aide msdn il y a ca :
    The DrawText function supports only fonts whose escapement and orientation are both zero.

  5. #5
    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
    je peux t'assurer que ça fonctionne j'utilise ce systeme dans un ActiveX.
    les coordonnées de ton rectangle sont correctes ?
    Quelle est la fonte utilisée ?
    Comment tu l’as initialisée ?

  6. #6
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2006
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 56
    Points : 34
    Points
    34
    Par défaut
    Voici ma fonction :
    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
     
    HBITMAP CUtils::CreateImageTexte(CDC *pDC,CFont *pFont,CString csTexte,RECT rect)
    	CDC dc;
    	RECT rectOk;
    	rectOk.left = 0;
    	rectOk.top = 0;
    	rectOk.right = 42;
    	rectOk.bottom = 100;
     
     
     
    	dc.CreateCompatibleDC( pDC );
     
    	HBITMAP hbmResult = ::CreateCompatibleBitmap(pDC->m_hDC, 42, 100);
    	HBITMAP hbmOldSource = (HBITMAP)::SelectObject( dc.m_hDC, hbmResult);
     
    // reglage de la fonte en mode vertical:
    LOGFONT lf;
     
    //1 récupération des paramètres d'une CFont ou d'une fenêtre  
    VERIFY(pFont->GetLogFont(&lf));
     
    // 2 changement des valeurs
    lf.lfEscapement=900;
    lf.lfOrientation=900;
    lf.lfItalic=1;
    lf.lfStrikeOut=1;
     
    // Création de la nouvelle fonte
    CFont FontVert;
    VERIFY(FontVert.CreateFontIndirect(&lf));
    CFont *pOldFont=dc.SelectObject(&FontVert);
     
    // Affichage final d'une chaîne stext, dans le rectangle rectText calculé au préalable bien sur.
    UINT nFormat=DT_LEFT|DT_SINGLELINE;
    	dc.SetTextColor(RGB(255,255,255));
    	dc.SetBkColor(RGB(255,0,0));		
    	dc.SetBkMode(TRANSPARENT);
    	dc.DrawText(csTexte,&rect,nFormat|DT_CALCRECT);
     
    	return hbmResult;
     }
    rect = rectOK

    merci de ton aide ...

  7. #7
    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
    tu peut essayer sans :
    lf.lfItalic=1;
    lf.lfStrikeOut=1;
    le nom de ta fonte ? tu ne me l'a pas dit .


  8. #8
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2006
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 56
    Points : 34
    Points
    34
    Par défaut
    j'ai enlever ce que tu me dis mais ca change rien.
    ma font est : Ms Sans Serif.
    ca a une importance la font ?

    A noter que si j'enleve le "DT_CALCRECT" je vois le texte mais toujours en horizontal.

  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
    ben oui ,ce n'est pas une fonte true type !
    je ne pense pas que ça fonctionne avec ce type de fonte.
    essaye avec courier new par exemple.
    exemple d'init logfont:
    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
     
        lg.lfHeight=-12;   
        lg.lfWidth=0;
        lg.lfEscapement=0;
        lg.lfOrientation=0;
        lg.lfWeight=400;
        lg.lfItalic=0;
        lg.lfUnderline=0;
        lg.lfStrikeOut=0;
        lg.lfCharSet=0;
        lg.lfOutPrecision=3;
        lg.lfClipPrecision=2;
        lg.lfQuality=1;
        lg.lfPitchAndFamily=49;
        strcpy(lg.lfFaceName,"Courier New");

  10. #10
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2006
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 56
    Points : 34
    Points
    34
    Par défaut
    bon je vois bien le texte avec le paramétrage que tu m'as donnée mais des que je mais 900 en orientation et escapement ben je vois plus le texte.
    j'ai pas un probleme avec mon RECT ?

  11. #11
    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
    Citation Envoyé par ouquoi
    bon je vois bien le texte avec le paramétrage que tu m'as donnée mais des que je mais 900 en orientation et escapement ben je vois plus le texte.
    j'ai pas un probleme avec mon RECT ?
    il faut bien sûr qu'il représente une surface verticale ....

  12. #12
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2006
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 56
    Points : 34
    Points
    34
    Par défaut
    rectOk.left = 0;
    rectOk.top = 0;
    rectOk.right = 42;
    rectOk.bottom = 100;

    C'est bien vertical ca ?

    En fait je vois un tout petit bout de texte (une ligne de pixel) tout en haut de mon rect.

  13. #13
    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
    ton systeme de coordonnées n'est pas inversé sur les y .?
    essaye de dessiner un rectangle pour visualiser ta surface .
    (CDC::Rectangle )


  14. #14
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2006
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 56
    Points : 34
    Points
    34
    Par défaut
    Mon rectangle couvre bien la zone voulue.
    si je fais un TextOut ca marche mais un drawtext je vois juste une bar.

  15. #15
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Février 2006
    Messages
    56
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 56
    Points : 34
    Points
    34
    Par défaut
    c normal que je sois obliger de faire avec un textout ?

  16. #16
    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
    c'est bizarre ...

Discussions similaires

  1. utiliser les tag [MFC] [Win32] [.NET] [C++/CLI]
    Par hiko-seijuro dans le forum Visual C++
    Réponses: 8
    Dernier message: 08/06/2005, 15h57
  2. MDI sans MFC, possible ?
    Par delire8 dans le forum MFC
    Réponses: 4
    Dernier message: 17/06/2002, 07h38
  3. [MFC](encapsulation ADO) ou placer le code
    Par philippe V dans le forum MFC
    Réponses: 2
    Dernier message: 13/06/2002, 14h58
  4. Réponses: 2
    Dernier message: 10/06/2002, 11h03
  5. [MFC] ADO connection
    Par philippe V dans le forum MFC
    Réponses: 3
    Dernier message: 10/06/2002, 07h36

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