如何在聚焦时改变TEdit的颜色

时间:2018-05-04 12:27:54

标签: background-color firemonkey onfocus

这可能很简单,我无法找到答案。

我想在点击它时(在焦点上)更改TEdit组件的背景颜色,当我点击其他地方时背景应该回到以前的颜色。

P.S。我使用Firemonkey和它的多平台应用程序,所以我需要使用一种风格。

1 个答案:

答案 0 :(得分:0)

The easiest way (and best) - place TRectangle without Stroke into Tedit, set its Align to Client and change its Fill color in Object Inspector.

Hard way: Tedit is using bitmap from styles. You can see your current style for Tedit - place StyleBook, Load your style from file, find 'editstyle' object. You can create a new style for Tedit (copy 'editstyle' in your current style, and name it like editstyle1, select background > Source Link in Object Inspector - select part on global style bitmap with your color, then you can change to new style like Edit1.StyleLookup := 'editstyle1'; Also use a useful forum: http://fire-monkey.ru with Google Translate.