Why doesn’t SS_WHITERECT actually draw a white rectangle?

Date:April 8, 2010 / year-entry #108
Tags:history
Orig Link:https://blogs.msdn.microsoft.com/oldnewthing/20100408-00/?p=14373
Comments:    11
Summary:There are six styles available to the static controls which draw frames and rectangles in one of three fixed colors: SS_BLACKRECT SS_BLACKFRAME SS_GRAYRECT SS_GRAYFRAME SS_WHITERECT SS_WHITEFRAME But if you actually create a static control with one of these styles, you'll find that the color isn't actually black, gray, or white. So why are they called...

There are six styles available to the static controls which draw frames and rectangles in one of three fixed colors:

SS_BLACKRECT SS_BLACKFRAME
SS_GRAYRECT SS_GRAYFRAME
SS_WHITERECT SS_WHITEFRAME

But if you actually create a static control with one of these styles, you'll find that the color isn't actually black, gray, or white.

So why are they called black, gray, and white?

Because they used to be black, gray, and white.

Knowledge Base article 125684 gives the history behind these styles. Back in the 16-bit days, these styles really did give you black, gray, and white, or at least they did if you used the default color scheme. Windows 95 shifted from using the window colors to the 3D colors, presumably to give the system a less harsh look.


Comments (11)
  1. 640k says:

    Is there any defined replacements with better names?

  2. Trevel says:

    As the linked article explains, yes. Yes there are.

  3. Jolyon Smith says:

    @Trevel:  No, it doesn’t.

    The linked article explains what colors the SS_XXX color styles map to, but you cannot use those colors in place of the SS_XXX style flags themselves.  There are no alternative SS_XXX styles defined along the lines of SS_3DHILIGHTRECT, SS_3DSHADOWRECT and SS_3DDKSHADOWRECT, for example.

    (Or if there are, the linked article does not identify them)

  4. CJ says:

    I’m not sure if this is very relevant, but it is slightly.  What colorful pattern do most property dialog boxes on XP have?  What I mean is if you flood-fill the screen-shot of My Computer -> Properties dialog box in mspaint in the grey central area, is does not work.  The reason is clearer if you tilt laptop screen, or zoom in 8 times, or the best way is to auto-level adjust the same screenshot in paint.net.

  5. Ivo says:

    @Dean Harding, about theme API. Yes and no. You should use the theme API when themes are present, but if the OS runs in classic mode the theme API doesn’t work. Unless you want to force your users to run Aero (or Basic), you should support the old-style look as well.

  6. Dean Harding says:

    Well, for any new development you should be using the theme API, so it’s kind of moot now anyway.

    Besides, while they’re not *actually* white, grey and black, they’re (usually) white-ish, grey-ish and black-ish. So it’s not like the colours are totally off.

  7. safe & sorry says:

    Safe mode also requires old apis. And will continue to require it for the foreseeable future in coming windows versions.

  8. Random832 says:

    Of course, in Windows 95’s default color scheme, the ‘black’ was still black, the ‘white’ was still white, and the ‘gray’ was (darker than before) gray.

  9. me says:

    They have been replaced with something else.  Would probably be a good time to ‘deprecate’ the names.  Use a pragma or just remove them from the SDK and doc it.

    ‘But that would require changing lots of code’.  Yes but you are recompiling it anyway.  You are at least somewhat close to the code.  With pragma you just get a warning.  With removing it would not compile.

    Leaving leftovers in the code lead to bugs.  With an SDK as old as the windows one I would bet there are hundreds of instances of this sort of thing.  It is also not without precedence where a bunch of the old CRT calls were ‘deprecated’.

  10. Yuhong Bao says:

    “Back in the 16-bit days, these styles really did give you black, gray, and white, or at least they did if you used the default color scheme. Windows 95 shifted from using the window colors to the 3D colors, presumably to give the system a less harsh look. “

    Don’t forget NT 3.x.

    [Perhaps you forgot that the nitpicker’s corner is closed. -Raymond]
  11. Yuhong Bao says:

    "Would probably be a good time to ‘deprecate’ the names. "

    Yep, unlike function names like OpenIcon and CloseWindow that are set in stone, constant names are just names of #defines, which can easily change without changing the actual value which is the one actually used in the binaries.

Comments are closed.


*DISCLAIMER: I DO NOT OWN THIS CONTENT. If you are the owner and would like it removed, please contact me. The content herein is an archived reproduction of entries from Raymond Chen's "Old New Thing" Blog (most recent link is here). It may have slight formatting modifications for consistency and to improve readability.

WHY DID I DUPLICATE THIS CONTENT HERE? Let me first say this site has never had anything to sell and has never shown ads of any kind. I have nothing monetarily to gain by duplicating content here. Because I had made my own local copy of this content throughout the years, for ease of using tools like grep, I decided to put it online after I discovered some of the original content previously and publicly available, had disappeared approximately early to mid 2019. At the same time, I present the content in an easily accessible theme-agnostic way.

The information provided by Raymond's blog is, for all practical purposes, more authoritative on Windows Development than Microsoft's own MSDN documentation and should be considered supplemental reading to that documentation. The wealth of missing details provided by this blog that Microsoft could not or did not document about Windows over the years is vital enough, many would agree an online "backup" of these details is a necessary endeavor. Specifics include:

<-- Back to Old New Thing Archive Index