CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 1999
    Posts
    8

    How to display an INCLINED (TILTED) TEXT in a view



    Hi,


    I want to display some text in a view with circle an lines.

    But my text has to be diplayed inclined or tiltled (I don't know the real word) that is to say on a line with an angle of 45° or 62° or any ° from the horizontal.


    The CDC class doesn't seem to give me the solution even using its DrawState Methods.


    does anyone have the solution ?


    Thanks

    Ciampo

  2. #2
    Join Date
    Apr 1999
    Posts
    32

    Re: How to display an INCLINED (TILTED) TEXT in a view



    When you create a font (CreateFont or CFont::CreateFont) one of the paramters you can specify is the "escapement" of the font. The on-line help says:


    ---

    nEscapement


    Specifies the angle (in 0.1-degree units) between the escapement vector and the x-axis of the display surface. The escapement vector is the line through the origins of the first and last characters on a line. The angle is measured counterclockwise from the x-axis.

    ---


    So you can have text at 45 degrees by setting escapement to 450.

  3. #3
    Guest

    Re: How to display an INCLINED (TILTED) TEXT in a view

    Thank you, daren
    I ve tried this in my view

    void CTestrView::OnDraw(CDC* pDC)
    {
    CTestrDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);

    // TODO: add draw code for native data here
    CFont myFont;
    if (!myFont.CreateFont( 32, 10, 450, 450, 1000,
    0, 0, 0, 0, OUT_DEVICE_PRECIS, CLIP_TT_ALWAYS,
    PROOF_QUALITY, DEFAULT_PITCH, NULL ))
    MessageBox ("Erreur de creation de Fonte", "", MB_OK);

    SetFont( &myFont, TRUE);

    pDC->TextOut (120, 120, (LPCTSTR) "toto", 4);
    }


    Toto is written but not inclined (tiled).
    Is there any special option to use at the font cration or does the matter comes from the SetFont call


    thanks
    Ciampo



  4. #4
    Guest

    Re: How to display an INCLINED (TILTED) TEXT in a view

    Hi.

    You probably need to select the font into the DC, via pDC->SelectObject().

    Yours,
    Wes


  5. #5
    Join Date
    May 1999
    Posts
    388

    Can we display tilted text on dialogs?

    Can we display tilted text on a dialog probably by using label control or any other way through code.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured