CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2004
    Posts
    3

    Unhappy AfxMessageBox: want other Font

    Hi,

    I need a bigger font in a (Afx-)MessageBox. Is this changeable?
    Has anybody an idea?

    Thanx
    Thommy

  2. #2
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: AfxMessageBox: want other Font

    Quote Originally Posted by ThommyTom
    I need a bigger font in a (Afx-)MessageBox. Is this changeable?
    Has anybody an idea?
    Yes: The system font size, as used for message boxes, dialogs etc. is configurable by the user under Windows (via the control panel). Well behaved applications respect the users choice and use that font for message boxes (which is automatic anyway).

  3. #3
    Join Date
    Oct 2001
    Location
    Dublin, Eire
    Posts
    880

    Re: AfxMessageBox: want other Font

    Another option is to use a custom dialogue box for which you set the font.
    Elrond
    A chess genius is a human being who focuses vast, little-understood mental gifts and labors on an ultimately trivial human enterprise.
    -- George Steiner

  4. #4
    Join Date
    Nov 2002
    Location
    Los Angeles, California
    Posts
    3,863

    Re: AfxMessageBox: want other Font

    The other choice you have is to write your own message box. I don't know your
    needs, so it may or may not be worth the trouble.

    //edit: or what Elrond said
    Wakeup in the morning and kick the day in the teeth!! Or something like that.

    "i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."

  5. #5
    Join Date
    Mar 2001
    Posts
    2,529

    Re: AfxMessageBox: want other Font

    Well roughly when you create messageboxes they use the system fonts. One work around is to just do your own message dialog.

    HTH,

    ahoodin

  6. #6
    Join Date
    Mar 2002
    Location
    Portsmouth, UK
    Posts
    121

    Re: AfxMessageBox: want other Font

    You can intercept all your AfxMessageBox calls in one place see CWinApp:: DoMessageBox. You could put a custom dialog there.

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: AfxMessageBox: want other Font

    Quote Originally Posted by ThommyTom
    Hi,

    I need a bigger font in a (Afx-)MessageBox. Is this changeable?
    Has anybody an idea?

    Thanx
    Thommy
    It is not so easy.... But nothing is impossible!
    Take a look at this thread: http://www.codeguru.com/forum/showth...LLBACK+CBTProc
    You could also find there a little sample projrct MessageFont.zip

    Regards,
    Victor

  8. #8
    Join Date
    Oct 2004
    Posts
    3

    Smile Re: AfxMessageBox: want other Font

    Thank you all so far.

    I hope that I not have to create my own dialog box ;-)

    But the hint of Victor looks fine. I will check it as soon as possible (but regrettably don't have the time today..;-( )

    Special hint: Enjoy live!!!!
    Thommy

  9. #9
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: AfxMessageBox: want other Font

    Quote Originally Posted by ThommyTom
    I hope that I not have to create my own dialog box ;-)
    Why? It's pretty straightforward, just a modal dialog box that you can draw with the resource editor.

    However, seems as if you chose to ignore the fact that the font used in message boxes is a user choice (by the UI guidelines), and the system already provides a way for the user to change the font. The fact that there is no easy way to change the font of standard UI elements is not accidental - it's by design. Usually, when the API designers make something difficult to do, there's a good reason for it: It should be easy for developers to create conforming user interfaces, and hard to break the rules.

  10. #10
    Join Date
    Oct 2004
    Posts
    3

    Smile Re: AfxMessageBox: want other Font

    [QUOTE=gstercken]Why? It's pretty straightforward, just a modal dialog box that you can draw with the resource editor.
    QUOTE]

    I don`t find it so easy, because you have to make all resizeable.
    P.e.: If you give the Messagebox a long text with "/n" (line breaks), you have to resize the Edit-Field and the dialogbox itself.
    Also different button combinations, icons,....

    ..ok, of course it's not impossible......but it takes a bit time (so why not to do it easier?... ) ;-))

    Best regards
    Thommy

  11. #11
    Join Date
    Oct 2001
    Location
    Dublin, Eire
    Posts
    880

    Re: AfxMessageBox: want other Font

    I understand that sometimes the need of a bigger font is there. But except for very important and exceptional messages, you should probably use the user settings, meaning that only rare cases should require you to use your own font. It should probably be easy enough to handle just a few cases for a custom dialogue.
    Elrond
    A chess genius is a human being who focuses vast, little-understood mental gifts and labors on an ultimately trivial human enterprise.
    -- George Steiner

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured