I think "skin" is better than "style" or "style" because it can contain animations associated with actions.
In FMX, the control can be drawn at will, and the personalized attributes of each part can be saved as a *. Style File.
Xe2 provides the following style files under "... \ Program Files \ Embarcadero \ rad studio \ 9.0 \ redist \ styles \ FMX:
Air. rule. Rule. styleblend. styledark. stylefmx. Platform. iOS. stylefmx. Platform. Mac. stylefmx. Platform. Win. Rule. styleios. stylemacblue. stylemacgraphite. Rule
The file is in text format. It is similar to a form file and can be read and managed using tstylebook.
However Program Apply a style, which is really simple:
Procedure tform1.button1click (Sender: tobject); begin application. stylefilename: = 'style filename '; // If the Style File and exe are in the same directory, the path end can also be omitted;
Add a tstylebook (stylebook1) to the form to load, edit, and save these styles.
After editing stylebook1, you can assign it to the stylebook attribute of the form directly:
Procedure tform1.button1click (Sender: tobject); Begin self. stylebook: = stylebook1; // only applies to the end of the current form;
Since the stylebook attribute of the form is also a tstylebook object, you can directly use it:
Procedure tform1.button1click (Sender: tobject); begin stylebook: = tstylebook. create (Self); // by default, stylebook has not been created for the form. filename: = 'style file'; // or use the next line // stylebook. resource. loadfromfile ('style file'); // tstylebook stores data end with resource (tstrings;
You can use the stylelookup attribute to modify the control style separately, for example:
Procedure tform1.button1click (Sender: tobject); begin button1.stylelookup: = 'checkbox'; end; // you can right-click the control during design
* Stylename naming conventions in the style file (which I guess ):
1. Class Name (remove the previous t) + 'style' // This is the style name of the independent control. 2. Class Name (remove the previous T) // This is the style name of the control child part. 3. Since the naming conventions are available, the control can be applied according to its own class name, therefore, we will find that the stylelookup attribute of most controls is not assigned a value. 4. The stylelookup attribute should be used to modify the stylelookup attribute of controls or child widgets, rather than stylename (I think stylename is a bit redundant ).
I found that stylename OF THE CHILD widget can be read:
Procedure tform1.button1click (Sender: tobject); begin showmessage (memo1.hscrollbar. stylename); showmessage (memo1.vscrollbar. stylename); end;
Other related methods, such as applystylelookup (), updatestyle (), and findstyleresource (), are generally automatically called.
The program will embed the default style into the resource (Name: defaultstyle, format: rt_rcdata). To restore the default style of the program, you only need:
Procedure tform1.button1click (Sender: tobject); begin application. stylefilename: = ''; // The program automatically applies the default style form1.stylebook: = nil; // if the form is set separately, restore the end;
Some people asked how to modify the style of the Form title bar?
I did not find a direct solution during the learning process;
I want to do this for the time being. I can only hide the title bar and re-draw it;
After learning more about the form mechanism, you may be able to find a solution from the *. Style File.
It's superficial. Who knows more? Could you tell me.