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

    MessageBox buttons

    Hey, I've added Application.EnableVisualStyles(); to my form code, but when I do MessageBox.Show("test"); the buttons still look pre-XPish.

    Does anyone know what the problem is?

    Thanks for the help.

  2. #2
    Join Date
    Dec 2009
    Posts
    109

    Re: MessageBox buttons

    Quote Originally Posted by jaikob View Post
    Hey, I've added Application.EnableVisualStyles(); to my form code, but when I do MessageBox.Show("test"); the buttons still look pre-XPish.

    Does anyone know what the problem is?

    Thanks for the help.
    So basically what your trying to do is changed theme in which the entire program's displayed right?

  3. #3
    Join Date
    Jan 2010
    Posts
    3

    Re: MessageBox buttons

    Indeed yes.

  4. #4
    Join Date
    Dec 2009
    Posts
    109

    Re: MessageBox buttons

    Should the theme be changed through Control Panel??

  5. #5
    Join Date
    Jan 2010
    Posts
    3

    Re: MessageBox buttons

    No, The application I am making in C# looks like a windows 2000 application, without button gradients. I add the above code, but my messageboxes still show a pre-XP themed button. It's the way the app looks.

  6. #6
    Join Date
    Dec 2009
    Posts
    109

    Re: MessageBox buttons

    Why do you want to display a MessageBox without any buttons?

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: MessageBox buttons

    Quote Originally Posted by jaikob View Post
    Hey, I've added Application.EnableVisualStyles(); to my form code, but when I do MessageBox.Show("test"); the buttons still look pre-XPish.

    Does anyone know what the problem is?

    Thanks for the help.
    IIRC, the MessageBox functionality is just wrappers around the OS Win32 message box. So the MessageBox will just use the visual style set by the OS settings.

    If the styles in your app are different than those of the OS, you'll need to create your own messagebox form in order to get your app specific styles.

  8. #8
    Join Date
    Apr 2009
    Location
    Ottawa, ON, Canada
    Posts
    34

    Re: MessageBox buttons

    Quote Originally Posted by jaikob View Post
    Hey, I've added Application.EnableVisualStyles(); to my form code, but when I do MessageBox.Show("test"); the buttons still look pre-XPish.
    Does anyone know what the problem is?
    Here is another description of the issue:
    http://www.nbdtech.com/Blog/archive/...d-Message.aspx

    Unfortunately, the workaround suggested doesn't seem to work for me in VSE 2010. Any constructive suggestions are appreciated.

    -t

  9. #9
    Join Date
    Apr 2009
    Location
    Ottawa, ON, Canada
    Posts
    34

    Re: MessageBox buttons

    Solved. It turned out the manifest file created in Visual Studio 2010 works on Vista and 7 but doesn't work on XP. On XP just use the manifest file at http://www.nbdtech.com/Blog/archive/...d-Message.aspx
    Last edited by tr00don; September 27th, 2010 at 05:22 PM.

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