Superscripts and Subscripts with MFC Application

This is a discussion on Superscripts and Subscripts with MFC Application within the Windows Programming forums, part of the Platform Specific Boards category; I'm putting together an MFC application and I want to have a superscript and a subscript. What is the best ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    197

    Superscripts and Subscripts with MFC Application

    I'm putting together an MFC application and I want to have a superscript and a subscript. What is the best way to do this? Should I just uses multiple font sizes on the same window? If so, how do I get multiple font sizes? This sounds trivial, but I seem to be stuck using just one font a window.

  2. #2
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Maybe this will help.

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    197
    I discovered that the text is in the resource file as follows:

    Code:
    IDD_WINTEST7_DIALOG DIALOGEX 0, 0, 244, 250
    STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | 
        WS_CAPTION
    EXSTYLE WS_EX_APPWINDOW
    CAPTION "Table of Physical Constants"
    FONT 8, "MS Shell Dlg", 0, 0, 0x1
    BEGIN
        RTEXT           "normal font",IDC_STATIC,7,14,109,8
        RTEXT           "subscript",IDC_STATIC,7,24,109,8
        RTEXT           "superscript",IDC_STATIC,7,34,109,8
    END
    I want the text "subscript" to be subscripted and the text "superscript" to be superscripted. I'm not sure whether or not there is a way to simply edit the resource file.

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    The FONT resource definition statement can't be used with individual controls so you'll have to set the fonts by sending a WM_SETFONT message with SendMessage and a suitable CFont in response to the dialog's OnInitDialog message handler.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21