Link to home
Start Free TrialLog in
Avatar of AndersCarlsson
AndersCarlsson

asked on

String with underline

How do i compose a string ( sprintf ) with underlined text ?
ASKER CERTIFIED SOLUTION
Avatar of rbr
rbr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AndersCarlsson
AndersCarlsson

ASKER

I need this for a program in a NT system.
Avatar of ozo
<u>and for what kind of display device?</u>
I want it for a string in a MessageBox, in a Windows applikation.
Message boxes cannot display underlined text.

Create a custom dialog with a static text control, and in the WM_INITDIALOG handler of said dialog create an underlined font and set it as the control's font.

Something like that:

    LOGFONT font = { 0 };
    HFONT   hFont;

    font.lfUnderline = TRUE;
    font.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN;
    hFont = CreateFontIndirect(&font);
    SendDlgItemMessage(hwnd, IDC_TEXT, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));