clMenuBar Renders Black on Windows 2000

Posted by on in Blogs
In Delphi 2007, you may notice some newer color constants towards the end of the list, with names like clMenuBar and clMenuHighlight. Beware! These color constants aren't supported on Windows 2000, and they render as black. Since the default menu text is also black, this makes the menus rather tough to read! If you use them then you should detect Win2000 (and possibly earlier OSs) in code and replace them with a supported constant such as clBtnFace.


Comments

  • Guest
    Jim McKeeth Friday, 29 February 2008

    Good to know, although I always thought Delphi should detect that for us behind the scenes and gracefully degrade. There were a few other times I had seen OS version specific features. Like the new Vista dialogs, they just throw an exception if you are not on Vista.

  • Guest
    Maksym Pyatnytskyy Saturday, 1 March 2008

    it's better to use the following check:
    var
    B: BOOL;
    ....
    if SystemParametersInfo(SPI_GETFLATMENU, 0, @B, 0) and B then {use clMenuBar} else {use clBtnFace};

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: