How to set text with superscripts as button label?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MLN
    New Member
    • Jun 2007
    • 5

    How to set text with superscripts as button label?

    Hello everyone,

    I am trying to create a button control with x^y as button label.
    How to set this text with superscript as label for the button control?
    Any help in this direction is highly appreciated.

    Thanks,
    MLN.
  • Savage
    Recognized Expert Top Contributor
    • Feb 2007
    • 1759

    #2
    Originally posted by MLN
    Hello everyone,

    I am trying to create a button control with x^y as button label.
    How to set this text with superscript as label for the button control?
    Any help in this direction is highly appreciated.

    Thanks,
    MLN.
    You can't set it as x^y without manually adding a static control above the button text.But you probably can xⁿ where ⁿ is 252 character of ASCII code.

    Comment

    • MLN
      New Member
      • Jun 2007
      • 5

      #3
      Originally posted by Savage
      You can't set it as x^y without manually adding a static control above the button text.But you probably can xⁿ where ⁿ is 252 character of ASCII code.
      Thanks for the reply,
      Do you mean that I should add some bitmap to show the text with superscript?

      Comment

      • rstackhouse
        New Member
        • Apr 2012
        • 1

        #4
        The following would set the text of the button to x²

        Code:
        CString text =  CString("x");
        
        text.AppendFormat("%lc\n", 178); //superscript 2.
        
        button.SetWindowText((LPCTSTR)text);

        Comment

        Working...