AndersCarlsson
asked on
String with underline
How do i compose a string ( sprintf ) with underlined text ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<u>and for what kind of display device?</u>
ASKER
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));
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));
ASKER