dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Displaying the degree symbol

  1. #1
    Guest

    Displaying the degree symbol

    Is there a way to format a string to save the degree symbol? I couldn't find any documentation in printf() or CString::Format() regarding it.


  2. #2
    Join Date
    Sep 1999
    Location
    NJ
    Posts
    1,299

    Re: Displaying the degree symbol

    The degree symbol (little circle in the corner) or the percent sign? There is no standard degree symbol in fonts, so there's no standard way to display it.

    To display a percent sign, use two in the format string:
    printf ("This (%%) is a %s sign", "percent");
    prints: This (%) is a percent sign.


    Truth,
    James
    http://www.NJTheater.com
    http://www.NJTheater.com/JamesCurran
    I don't do it for the points (OK, maybe I do), but rating a post is a good way for me to know if I helped.

  3. #3
    Guest

    Re: Displaying the degree symbol

    I was hoping to be able to display the little circle for angular measurements. I want to be able to show it on the status bar. Is there any other way to do it besides using a string? Maybe is there a way to display a graphical symbol that I draw inside of the resource editor?


  4. #4
    Join Date
    May 1999
    Location
    West Sussex, England
    Posts
    1,939

    Re: Displaying the degree symbol

    The degree symbol (ascii code 248 in the OEM character set) can be used in strings as long as the character is supported in the font you use to display it in.
    If you want to add the character explicitly to a string using a format statement in say sprintf, printf, or CString::Format you can use the \xxx terminology for the character where xxx is the octal index of the ascii code for the character. For the degree symbol this is \370.


    CString text ;

    text.Format("The temperature today was a whopping %.1f\370C!", temp) ;




    HTH


    Roger Allen
    ICQ - 31764540
    Another problem solved - Not!
    Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
    Please remember to rate useful answers. It lets us know when a question has been answered.

  5. #5
    Join Date
    Sep 1999
    Location
    NJ
    Posts
    1,299

    Re: Displaying the degree symbol

    In most fonts, the degree symbol is character 176 which can be coded in a format string as "\xB0". In other fonts, it's 186 ("\xBA") or 248 ("\xF8")

    Truth,
    James
    http://www.NJTheater.com
    http://www.NJTheater.com/JamesCurran
    I don't do it for the points (OK, maybe I do), but rating a post is a good way for me to know if I helped.

  6. #6
    Join Date
    Sep 2019
    Posts
    2

    Re: Displaying the degree symbol

    Quote Originally Posted by James Curran View Post
    In most fonts, the degree symbol is character 176 which can be coded in a format string as "\xB0". In other fonts, it's 186 ("\xBA") or 248 ("\xF8")

    Truth,
    James
    http://www.NJTheater.com
    http://www.NJTheater.com/JamesCurran
    I don't do it for the points (OK, maybe I do), but rating a post is a good way for me to know if I helped.
    Thanks for reply. That's very descriptive.

  7. #7
    Join Date
    Sep 2019
    Posts
    2

    Re: Displaying the degree symbol

    Is there a new method for the degree symbol?

  8. #8
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,109

    Re: Displaying the degree symbol

    Quote Originally Posted by erickzind View Post
    Is there a new method for the degree symbol?
    No

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)