Reputation: 7394
I am emulating (to the degree possible) a TPopup Menu so it can float and users can drag it around.
To do this, it's on its own form, and uses TPanels acting as if they are clickable TMenuItems.
I'm using TPanels so I can change their color.
To get the colors right, how can I determine at runtime (in Delphi 2010) the current theme's colors for TMenuItem.Color and TMenuItem.Font.Color (assuming such properties existed).
TIA
Edit
I could use clBtnFace for the background, and clWindowText for the text color. But, I need to know the the theme colors for when the mouse is over a menu selection.
Upvotes: 1
Views: 2526
Reputation: 14001
Have a look at my answer to How can I get the color for a themed tabsheet - especially the edit.
The relevant constants can be found under Parts and States. Just search for "MENU" on that page.
Edit: There are tools to explore themes visually - see Windows Visual Themes: Gallery of Parts and States?. (Thanks to @TOndrej for bringing this up.)
Upvotes: 5
Reputation: 116190
I believe the popupmenu uses the colour in the clMenu
constant. If you need the colour as an rgb value, use ColorToRgb(clMenu)
to translate it. There's clMenuBar, clMenuText and clMenuHighlight constants too.
Upvotes: 4
Reputation: 53476
You can use the constants clMenu and clMenuText.
There are more windows colors defined in Graphics.pas
Upvotes: 1