gurukg102498
asked on
AfxMessageBox
Hi,
I have a CString called HELLO.
CString say temp = HELLO.
I want to make this string to APPEAR As a BOLD and ITALIC STRING in the AfxMessageBox?
How can I do this?
Syntax is: AfxMessageBox(temp);
Thanks
I have a CString called HELLO.
CString say temp = HELLO.
I want to make this string to APPEAR As a BOLD and ITALIC STRING in the AfxMessageBox?
How can I do this?
Syntax is: AfxMessageBox(temp);
Thanks
ASKER
Hi Jason
Could you be more elaborate on this.I know there is no direct way to do that.But how will I implement this.Pls let me know.
Could you be more elaborate on this.I know there is no direct way to do that.But how will I implement this.Pls let me know.
Yes i agree with Jason, in order change the font (bold/italic) of the original MessageBox you'd have to subclass it or write your own.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
what u wanna do is derive from CDialog and make your own message box class.
add data member CFont m_fontSpecial.
and in OnInitDialog() add the following:
LOGFONT lfNew;
ZeroMemory (&lfNew, sizeof(LOGFONT));
lfNew.lfHeight = 18;
lfNew.lfItalic = TRUE;
lfNew.lfWeight = FW_BOLD;
strcpy (lfNew.lfFaceName, "Book Antiqua"); //or any other font
m_fontSpecial.CreateFontIn direct(&lf New);
now use GetDlgItem() and SetFont() to change the font to some control, for example if u have message box and the text is displayed by using CStatic do like this:
GetDlgItem(IDC_STATIC)->Se tFont(&m_f ontSpecial , TRUE)
if u need a sample app post your e-mail address.
cheers
add data member CFont m_fontSpecial.
and in OnInitDialog() add the following:
LOGFONT lfNew;
ZeroMemory (&lfNew, sizeof(LOGFONT));
lfNew.lfHeight = 18;
lfNew.lfItalic = TRUE;
lfNew.lfWeight = FW_BOLD;
strcpy (lfNew.lfFaceName, "Book Antiqua"); //or any other font
m_fontSpecial.CreateFontIn
now use GetDlgItem() and SetFont() to change the font to some control, for example if u have message box and the text is displayed by using CStatic do like this:
GetDlgItem(IDC_STATIC)->Se
if u need a sample app post your e-mail address.
cheers
You still have the following questions open. Please resolve them, as I will revisit them within the next seven to ten days. Admin has been notified, and failure to take care of these questions can have an impact on your account.
https://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=20182211
https://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=20181306
https://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=20135234
https://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=11525402
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=11548799
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mfc&qid=20238595
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mfc&qid=20208966
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mfc&qid=20057346
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20135235
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20128781
Netminder
CS Moderator
https://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=20182211
https://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=20181306
https://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=20135234
https://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=11525402
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=11548799
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mfc&qid=20238595
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mfc&qid=20208966
https://www.experts-exchange.com/jsp/qShow.jsp?ta=mfc&qid=20057346
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20135235
https://www.experts-exchange.com/jsp/qShow.jsp?ta=asp&qid=20128781
Netminder
CS Moderator
Admin notified of User neglect. Force-accepted by
Netminder
CS Moderator
Netminder
CS Moderator
If you're going to do it a lot in future, write a class that will allow this. Otherwise, I'm afraind you're going to have to implement a simple dialog box that appears to be exactly the same as the system dlg box, with extended functionality, using possibly a rich edit control.
Regards,
Jason