如何确定Windows主题TColors [英] How to determine Windows Theme TColors

查看:254
本文介绍了如何确定Windows主题TColors的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我模拟(尽可能多的)一个TPopup菜单,所以它可以浮动,用户可以拖动它。

I am emulating (to the degree possible) a TPopup Menu so it can float and users can drag it around.

为了做到这一点,它是在自己的形式,并使用TPanels就像是可点击的TMenuItems。

To do this, it's on its own form, and uses TPanels acting as if they are clickable TMenuItems.

我使用TPanels,所以我可以改变他们的颜色。

I'm using TPanels so I can change their color.

为了获得正确的颜色,我如何在运行时(在Delphi 2010中)确定TMenuItem.Color和TMenuItem.Font.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

编辑

我可以使用clBtnFace为背景,而clWindowText为文本颜色。

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.

推荐答案

我相信popupmenu会使用在 clMenu 常量中的颜色。如果你需要颜色作为一个rgb值,使用 ColorToRgb(clMenu)来翻译它。还有clMenuBar,clMenuText和clMenuHighlight常量。

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.

这篇关于如何确定Windows主题TColors的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆