+ Reply to Thread
Results 1 to 9 of 9

Windows Visual Style

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Windows Visual Style

    I've been working on a project that I've been designing in Windows 7. It is very Form driven and the button/background colors have all been set using Windows System colors.

    The end users will be using this project on a Windows Server. It is set to Windows Classic Style by corporate group policy.

    Needless to say the forms look ghastly when they display in the System colors used by Classic.

    So I've been thinking...
    1. UPDATE - SOLVED Would it possible to use API to detect if the OS is using Windows Classic Style?
    2. Would it be possible to calculate (or maybe someone already has) the Palette equivalent of the non-classic style System colors? e.g. say we have System color "Scroll Bars", what is the nearest equivalent in Palette?

    My idea is that I could detect on WB open whether the OS is using Classic Style or not (using answer to #1). If it is then a global variable would be set to indicate this and all UserForms initialize could be set to programatically change their buttons & backgrounds to use the nearest palette equivalent (using answer to #2). Wouldn't look as good but still an improvement over Classic Style color theme!
    Last edited by mc84excel; 04-08-2014 at 06:39 PM. Reason: add solved note to question 1
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Windows Visual Style

    I would expect for #1 you would need to pick it up from the registry, maybe something like:
    Please Login or Register  to view this content.
    ?

  3. #3
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Windows Visual Style

    I do not think API is necessary. Colours are specific hex value and you will know what they are when you design the form. You may simply add constants to your project to colour your controls - scrollbars colour is &H80000000&.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Windows Visual Style

    The following thread discusses obtaining 'Windows Classic Theme' information using
    one of:
    a. Registry Entry: HKEY_USERS\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
    b. IsThemeActive() from uxtheme.dll

    See http://vbcity.com/forums/t/73483.aspx

    Lewis

  5. #5
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Windows Visual Style

    Quote Originally Posted by Izandol View Post
    I do not think API is necessary. Colours are specific hex value and you will know what they are when you design the form. You may simply add constants to your project to colour your controls - scrollbars colour is &H80000000&.
    No offence Izandol but I don't believe you have understood my problem.

    I prefer to use Windows System colors for buttons & forms. e.g. Me.BackColor = vbScrollBars. (and yes, as you point out I could set this as hex - &H80000000&)
    My design choice of Windows System color palette works fine when the form is displayed on a Windows OS that is not using Windows Classic Style.
    However. When the same form displays on a PC/Server that is using Windows Classic Style, the colors appear different. It seems that Windows Classic Style uses a slightly different color palette for form objects?
    In any case, the form that looked good when designing on Windows 7 looks headache inducing when appearing on the end users server.

    So I've decided to create two different color themes for each form. The choice of colors used would depend on whether the end user is using Windows Classic Style or not. Which leads me back to my opening post - I need a way to detect this. And the hex for the nearest color equivalent (as appearing on Classic) to the appearance of the System colors (as appearing on non-Classic)

  6. #6
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Windows Visual Style

    Quote Originally Posted by ragulduy View Post
    I would expect for #1 you would need to pick it up from the registry, maybe something like:
    Thanks ragulduy. I tried it and received a Null error on both machines. Thanks for the suggestion anyway.

  7. #7
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Windows Visual Style

    Quote Originally Posted by LJMetzger View Post
    The following thread discusses obtaining 'Windows Classic Theme' information using
    one of:
    a. Registry Entry: HKEY_USERS\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
    b. IsThemeActive() from uxtheme.dll

    See http://vbcity.com/forums/t/73483.aspx
    Lewis
    Thanks Lewis! +1

    That was exactly what I was looking for.

    The code below returns the correct result on each machine.
    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Windows Visual Style

    OK question 1 is solved. 1 question left.

    "Would it be possible to calculate (or maybe someone already has) the Palette equivalent of the non-classic style System colors? e.g. say we have System color "Scroll Bars", what is the nearest equivalent in Palette?"

    This is badly worded. I'll try again. The problem is - that no matter what you set a backcolor as - the color won't appear the same when it is displayed on a system using Windows Classic style theme.

    This is most obvious when using blue colours. To give an example I am using a backcolor of vbHighlight (hex = &H8000000D& ). On Windows 7 this appears as a startling bright electric blue. However when it appears under Classic Style, this blue is a very dark murky blue (And No, it's nothing to do with the monitor settings - I tested the difference using the same monitor)

    So - for each system color - I need to determine what is the nearest equivalent color to use instead - so that the form control/object will still appear with the intended color when shown using Classic.


    See below for an example. As you can see I am a long way off getting the colours close.
    Please Login or Register  to view this content.
    Last edited by mc84excel; 04-13-2014 at 06:44 PM. Reason: typo

  9. #9
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Windows Visual Style

    This will help towards solving the problem - http://www.excelforum.com/excel-prog...ackcolors.html - by showing what each system color looks like on your current style.

    Note that the system colors will vary slightly depending on what theme you are currently using.

    My main goal is to not use the System Colors as backcolors when the form appears on a PC using Classic Style theme.
    Last edited by mc84excel; 04-15-2014 at 07:15 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Windows 7 :Windows 7 repair installation without booting into windows?
    By shanew in forum Microsoft Windows Help
    Replies: 0
    Last Post: 11-28-2009, 01:28 AM
  2. UserForm determine WinXP windows style
    By Reinhard Thomann in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2005, 12:06 PM
  3. Range.Resize from Visual Basic in Windows to Excel
    By MMesarch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2005, 12:06 PM
  4. [SOLVED] Windows XP, Excel 2000: ODBC driver for Visual FoxPro tables
    By Arvi Laanemets in forum Excel General
    Replies: 0
    Last Post: 01-24-2005, 05:06 AM
  5. Excel C# programs with Visual Studio .NET on Windows XP Family Edi
    By Hugues Joly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-05-2005, 10:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1