It turns out that among other bugs, sometimes the TForm.StyleBook property does not automatically get assigned. If you make sure it is assigned, then the above steps work.
Quick steps:
- Create form.
- Drop style book on form, and assign Form.StyleBook = StyleBook1
- Right click on control you wish to modify style on, click Edit Custom Style.
- Go to object inspector and modify Fill property to change background color of panel, for instance.
- Apply and close. (May have to click two, three or four times due to window focus bugs)
Note: This workaround is not useful in Delphi XE4 and up as the feature "Custom style setting" was removed from Mobile application FMX.
Update 2015: Remy's idea of recreating .DPROJ files carefully by hand, is excellent advice and should be considered first, even though my answer is marked accepted.
Delphi versions prior to XE2 used resource files as an INPUT and an OUTPUT in the compilation process. For example, your delphi 7 project icon is embedded in that .res file, which you "want delphi xe2 to use", however, that's problematic in delphi 7, and now flat out impossible in XE2. Instead you now treat the .res file as a pure output artifact, the same as executable files. Don't bother checking .res files into version control any more, and don't try to pretend that the .res file is the place where you permanently store your icons. It's an output file produced automatically by the compiler, as it always should have been.
If you are a modern developer, the old way Delphi 7 worked might have annoyed you (it sure annoyed me) because you have the interesting and unsolveable question about what to do for version control: Do you check in the .RES file, or don't you? There were drawbacks to both approaches, and the fact that .RES files are now output artifacts only in XE2 is for the best. So learn to live with that.
Now that XE2 supports icons not only for a PC but also for a Mac, it must handle things differently, and they have cleaned this up. This is the origin of the problem you're seeing with the .ICO file. I have seen exactly the same error, and I have ignored it, and simply added the icon back to the project after it has otherwise been converted.
Converting a delphi 7 project (.dpr and .cfg) to Delphi XE2 is not as big a problem as the conversions between various levels of .dproj files -- each version starting with Delphi 2005,2007,2009,2010, and onwards has implemented changes in the dproj format. When problems occur with converting these projects, I do not do as Remy suggests, because it's a waste of time. What I do is DELETE the DPROJ and let it convert up from a .dpr file only.
But Remy's advice to start from scratch has many advantages, including that you may simplify your project layout.
Anyways, here's what you do:
- Ignore error.
- Add icon to project yourself.
- Continue merrily along, and don't worry about the deletion of the .res file, that's intentional, and for good reasons. A new one will be created whenever needed. The filename of the .ico file on disk will be read by using the contents of the XE2 .dproj file and compiled into the .res file, as it should be.
Best Answer
VCL Styles and Firemonkey Styles are fundamentally different.
Because of that I am not sure they should have used the same name.
VCL Styles
TStyleManager.SetStyle('StyleName');
to your codeTStyleManager
classFiremonkey Styles
Editor is Internal to the IDE
TStyleBook
Resource Property EditorCan also be accessed by Right click on any visual control and selecting either
Note: These two menu choices are only available in desktop apps, not mobile apps.
Once in editor you can select the
Load..
button to change the style for the selected TStylebook. If the entire application is using the same TStyleBook it will change the whole application.TStyleBook
On windows 7 all of the styles both VCL and Firemonkey by default are placed in the
C:\Users\Public\Documents\RAD Studio\9.0\Styles
directoryOne bullet point is a direct answer, but I felt like I had to give the long answer to help others.