Results 1 to 7 of 7

Thread: Simple MSGBOX question

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441
    Is there a way to change the font on a VB messagebox? If so, how?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    The font in a messagebox is defined in the windows display settings. The only way to change them, is to change them system wide. If you like another font for your application only, you have to create your own messagebox form.

  3. #3
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444
    he is right
    you could read what the windows settings are and store them.
    change the setting.
    show the message box
    after the user clicks one of the buttons
    reset the system.
    more work then the message box was intended for IMO
    right click on your desktop and select properties.
    it is under appearance/message box.
    some people would not like you to change this though.
    people with disabilities set these for specific reasons, I would not make the assumption that everyone has 20/20 vision.
    I am so skeptical, I can hardly believe it!
    PS I am not a 'hyperactive member' I am a cool, calm, and collected member

  4. #4
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810

    Smile

    Why not build your own message box?

    Create a form with a label set to the font required, and display it with the required buttons.

    I have built such a form, with all the messages I require in a resource file, including formatting details for width, height, font, colour, buttons, htmlhelp refs etc (these are in a CSV type format).

    All I do is pass the resource ref no to a function, parse the data, which loads the form modally, displays the required buttons and form properties, and sends back the usual vbYes, vbNo, etc constants when the buttons are clicked.

    I have also done the same with a TXText control, with the data in a database. This allows messages to include tables pictures and fully formatted text.

    Sorry, though, I cannot send you the source as it is owned by my company!
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  5. #5
    Guest
    If you decide to make your own Message Box, use vbModal to keep the form on top and disable all other forms behind it.

    Code:
    msgfrm.Show vbModal

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    From a completely different thread, I wrote a C++ DLL to 'hook' into the windows MessageBox function. I'm sure I could set the font on that one as well. At the moment all it does is have a custom position. There is source and an example here: http://www.parksie.uklinux.net/customwin.zip
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7
    Fanatic Member Mad Compie's Avatar
    Join Date
    Aug 2000
    Location
    Kuurne (Belgium)
    Posts
    553
    I'm writing a kiosk GUI program in VB6.
    I had to create my own MessageBox, since the lay-out is very simple of the MsgBox() command.
    I used a Form with no borders, created my GUI on it and set it on top of the screen, disabling the owner Form.
    The calling procedure "MyMsgBox()" executes a loop combined with the DoEvents statement and checks continuously for a variable's status. It's very simple, considers some attention to the DoEvents statement and is purely written in VB! You can even play a .AVI in your MsgBox!

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