8
votes

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
Yes, it comes from the style. I haven't fully investigated, but look in the FMX.Forms unit at the TWindowBorder object which is what pulls out the styles.Mike Sutton
Okay. I'll read the FMX.Forms sources and see if I can figure out. There are no demos/samples included either.Warren P
Relevant blog post from Embarcadero staff person on this subject: blogs.embarcadero.com/ekryukov/2012/10/03/…Warren P
@WarrenP I did not understand how you make to get the Luna.Style, what file did you open? I dont have any luna.* on my windows 8 box. And I really need to add the non-client area in a thin border with icons and same color as form´s background in XE5. Appreciate any help.Eduardo Elias
The Luna.Style doesn't come with it, but of course, a Luna.vsf DOES, which I just open in the Style Designer, then Save As and change type to .Style (Fmx) and I've got the .Style file, and it contains the needed type. – (Comment on answer below! Did you even READ everything?)Warren P

1 Answers

7
votes

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