Results 1 to 7 of 7

Thread: XP Theme... AGAIN! [UNRESOLVED]

  1. #1

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Arrow XP Theme... AGAIN! [UNRESOLVED]

    ok...

    I know this has been asked like 2,000 times... but I was wondering why XP themes don't work on my App...

    I have used skybound and integrated visual style objects but it doesn't work in my project...

    VB Code:
    1. Public Sub New()
    2.         MyBase.New()
    3.         'Application.EnableVisualStyles()
    4.         'Application.DoEvents()
    5.         Skybound.VisualStyles.VisualStyleProvider.EnableVisualStyles()
    6.  
    7.         InitializeComponent()
    8. End Sub

    I was wondering... How can I apply the visual styles on a single form, or on all forms I got...

    Do I need to apply the

    'Application.EnableVisualStyles()
    'Application.DoEvents()

    header before ALL the forms? (tried, doesn't work), on the single startup form (tried, still doesn't work)...

    anyways, it's 4:00 am here, I'm gonna rest it and look it up again tomorrow!

    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: XP Theme... AGAIN! [UNRESOLVED]

    You need to make the call before any form is initialized or shown. Usually as the first lines of code work best.

    For the skybound issue I would suggest a DoEvents maybe? If you apply the VS to a form it will apply to all forms in your app.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: XP Theme... AGAIN! [UNRESOLVED]

    As Rob says, enabling visual styles has to be the first thing you do, so you should call either EnableVisualStyles method as the first line in a Main method. You would normally then call Application.DoEvents immediately after. Note that the call to DoEvents is only required if you use an ImageList somewhere in your app, but it's a good idea to include it by default regardless.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: XP Theme... AGAIN! [UNRESOLVED]

    I have not tested Skybound, but normally when you enable visual styles you have to set the FlatStyle property of the controls to 'System' otherwise they will keep their old-skool look.

    Have you done this? (assuming it's necessary with skybound)
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  5. #5

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: XP Theme... AGAIN! [UNRESOLVED]

    ya I did get my controls with flatstyle=system... I'll just add this app.doevents thing... wait up


    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  6. #6

    Thread Starter
    Fanatic Member Ruku's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    655

    Re: XP Theme... AGAIN! [UNRESOLVED]

    nop, not workin'...


    Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
    Website: http://DreamForgery.com

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: XP Theme... AGAIN! [UNRESOLVED]

    If you are using Skybound VisualStyles then you are specifically NOT supposed to set the FlatStyle to System. You call the Skybound version of EnableVisualStyles, but it must be in your Main method. You then add a VisualStyleProvider object to each form that needs to make use of one. Everything else is taken care of for you. Mind you, I suggest specifically disabling the VisualStyleProvider support for those controls for which it will make no difference to speed up rendering. This would include Buttons with no image, for which you WOULD just use the FlatStyle property.
    VB Code:
    1. Public sub Main()
    2.     Skybound.VisualStyles.VisualStyleProvider.EnableVisualStyles()
    3.     Application.DoEvents()
    4.     Application.Run(New Form1)
    5. End Sub
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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