CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2002
    Location
    DC Metro Area, USA
    Posts
    1,509

    Question EnableVisualStyles and Toolbars

    There seems to be a problem with enabling XP style (EnableVisualStyles) and toolbars, i.e. the buttons will not display images. Has anyone solved this/found a work around???
    bytz
    --This signature left intentionally blank--

  2. #2
    Join Date
    Feb 2004
    Posts
    6
    The support for XP Visual Styles is not well-implemented in .NET Framework 1.1. You should use the manifest file instead of using EnableVisualStyles().

    Zembaliti

  3. #3
    Join Date
    Sep 2002
    Location
    DC Metro Area, USA
    Posts
    1,509
    Hate to sound dense here, but do you know of an example that shows how to do this? I tried creating a app.exe.manifest file and added it to the project but that didn't work. And, as usual, I'm looking in all the wrong places in the online help....

    TIA, for any help.
    bytz
    --This signature left intentionally blank--

  4. #4
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503
    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 
    <assemblyIdentity 
        version="1.0.0.0" 
        processorArchitecture="X86" 
        name="Microsoft.Windows.Your_App_Name_Here_Without_EXE"
        type="win32" 
    /> 
    <description>Your app description here</description> 
    <dependency> 
        <dependentAssembly> 
            <assemblyIdentity 
                type="win32" 
                name="Microsoft.Windows.Common-Controls" 
                version="6.0.0.0" 
                processorArchitecture="X86" 
                publicKeyToken="6595b64144ccf1df" 
                language="*" 
            /> 
        </dependentAssembly> 
    </dependency> 
    </assembly>
    save this as file named ::: yourApp.EXE.MANIFEST

    off you go
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  5. #5
    Join Date
    Sep 2002
    Location
    DC Metro Area, USA
    Posts
    1,509
    Actually, it was more of the last bit contained in "off you go"... i.e. the only way I could figure to get this to work was to insert the .manifest file in the same location as the exe. Is there any way to "embed" it in the app itself?
    bytz
    --This signature left intentionally blank--

  6. #6
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503
    embedding the file doesnot gave anything good as far as i worked on the issue.
    so, when i create deployment project, i simply add manifest file and place it next to my application exe.
    no other way as such.
    I even worked with Enable visual styles function but when you run the program on W2K or NT, it returns error and the application goes head down. so, if you want to include visual styles and you are sure that no one is going to the app on w2k or NT. you can go for enablevisualstyles function and it works pretty fine. (only on XP)...
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  7. #7
    Join Date
    Sep 2002
    Location
    DC Metro Area, USA
    Posts
    1,509
    It may work fine for most things on XP but for some reason the toolbars don't display images. I tried using a imagelist with images placed in the wizard, and loading (.AddStrip) a stirp af images from an embedded resource. Neither set of images would show. Hmm, maybe I should try just loading the image strip at run time...

    Another strange thing is that if you use the wizard to put images in the image list, use it with a verticle toolbar, and dock on top and bottom, the image will not display...
    bytz
    --This signature left intentionally blank--

  8. #8
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503
    you have to check whether AutoSize property of toolbar is set to true.
    the images are displayed as it is in my projects. I face problems when i put text and change between show Below and show Right.
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  9. #9
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503
    embed a manifest file into exe

    A Win32 resource must be added to your .exe. The type of the resource must be "RT_MANIFEST" and the resource id must be "1". An easy way to do this is with Visual Studio.NET:

    1. Open your exe in VS (file -> open file)
    2. Right click on it and select add resource
    3. Click "Import..." from the dialog
    4. Select your manifest file
    5. In the "Resource Type" field, enter "RT_MANIFEST"
    6. In the property grid, change the resource ID from "101" to "1".
    7. Save the exe.
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  10. #10
    Join Date
    Mar 2004
    Posts
    1
    Application.DoEvents();

    Right after enable visual styles.

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