Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 783
Warren P Avatar asked Oct 04 '12 03:10

Warren P


1 Answers

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)

enter image description here

From the styles included with delphi try the Luna.Style

enter image description here

like image 168
RRUZ Avatar answered Nov 15 '22 22:11

RRUZ