How do you style the non-client area in a Firemonkey FM2 application in Delphi XE3

独自空忆成欢 提交于 2019-12-18 13:28:33

问题


I previously asked this question in the Delphi XE2 timeframe, and the answer then was a pretty ugly hack.

Now Delphi XE3 supports non-client theming, according to the official release notes. How do you do it in Delphi XE3 in Firemonkey FM2?

I believe it must be something to do with the style-book, but I can't figure it out. The form itself has an "EnableBorderStyling" property which I set to true, and I am thinking I must have to load a style that contains some nonclient theme data, but I can't find a style that includes it.

The help has nothing about this subject.

Update2 Okay, it's not broken, it's just that I don't have a style that contains this style element (as RRUZ says).

procedure TForm1.FormShow(Sender: TObject);
begin
  StyleBook := StyleBook1;
  WindowBorder.UpdateStyle;
end;

Update3: Style files appear to be in two different locations, which is confusing:

  C:\Program Files (x86)\Embarcadero\RAD Studio\10.0\Redist\styles\Fmx        
  C:\Users\Public\Documents\RAD Studio\10.0\Styles

Note that I don't have a Luna.Style (firemonkey style) in either spot, however 5 seconds with the Style Editor tool. (Open, and Save as, and change type to .Style, and I had one!)

Update4: RRUZ's answer works, but on my system (Windows 8 RTM) the non-client styles don't look right, they have white corners around the areas of the on't fully paint . Resizing the window makes it go away, and I'm pretety sure I should be able to force a WM_NCREPAINT or something, and make it go away.


回答1:


To Style the non client area of a Firemonkey application the selected style must have a windowborderstyle element defined (as is show in the picture)

From the styles included with delphi try the Luna.Style



来源:https://stackoverflow.com/questions/12719749/how-do-you-style-the-non-client-area-in-a-firemonkey-fm2-application-in-delphi-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!