Ancient Delphi VCL app looks to have no Windows theme or VCL Style

六眼飞鱼酱① 提交于 2019-12-11 12:28:55

问题


That's my analysis, anyway. I "distributed" my app to our organization this morning only to learn that, after a month of new work in XE8 on this old win32 app, clients not using the Windows 7 "Basic" theme see a very faded appearance. But those of us using remote desktop or using the Basic theme see about what I think we've always seen.

Facts:

  • Made with XE8, Win32, current Raize components
  • XPMan removed along the way
  • "Enable themes" is "on" in all configs, Metropolis checked, Windows is set as the default theme in Appearance.
  • A recent small app with some Raize components looks fine, and I've tried to follow the pattern laid down by this app.
  • Truths:

    1. I've been carrying this app around since Delphi 1; I may have rebuilt the project source around Delphi 2 but other than that, I haven't messed with the dproj file much.
    2. I suspect I'll have to focus on the resource compile bit. The only resources I know are the icon and the manifest, and I'd guess the manifest is the real problem here. I removed "XPMan" about a month ago but did not deploy until this morning.

The dpr looks like this:

program db_silookup;
uses
  Vcl.Forms,
  Vcl.Themes,
  Vcl.Styles,
  //...
  {$R *.res}
  {$R 'win7.rc'}
begin
  Application.Initialize;
  Application.UseMetropolisUI;
  Application.CreateForm(TfmSi, fmSi);
  Application.CreateForm(TfmXferList, fmXferList);
  TStyleManager.TrySetStyle('Windows');
  Application.Title:='Law School Lookup';
  Application.Run;
end.

And because I suspect it matters, win7.rc is:

1 24 "win7.manifest"

Which in turn is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity type="win32" name="App" version="3.1.0.0" processorArchitecture="*"/>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="*"/>
    </dependentAssembly>
  </dependency>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!--The ID below indicates application support for Windows Vista -->
        <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
        <!--The ID below indicates application support for Windows 7 -->
        <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
    </application>
  </compatibility>
</assembly>

回答1:


Since you are including your own manifest you should disable "Enable runtime themes" or you will have duplicate manifests included in exe, but there can be only one.

You should use "Use custom manifest option" instead, remove {$R 'win7.rc'} and let Delphi compile it for you. That will also make it easier for you to change manifest as needed.




回答2:


Disable / remove everything related to Metropolis from your app. Metropolis is only meant for Windows 8+ Metro style apps, which legacy apps have no business working with (unless you wish to convert your UI to Metropolis which is practically a re-write).

It seems as if the usage of Metropolis UI has overridden your colors and is using the colors which it would otherwise be using in a Metro style application.

Another option (while cleaning up) would be to start from scratch without a .dproj file (back it up just in case). It will automatically detect the type of app and upgrade it to default settings. You will still of course have to re-do many things in the setup, but it's a good way to rid any old references and clean up these sort of problems (given you've already removed all other Metropolis references).




回答3:


There's value in all the suggestions here -- they simplify. In the end, though, the problem was Aero Glass. "SheetOfGlass" had got enabled in the app's root form.

Side notes

  • Remote Desktop is no substitute for seeing what an app really looks like.

  • The value of "themes" is debatable. My opinion is that an app should conform more or less to platform norms. I went down the theme path because that gets us "easy" support for text cues in text inputs.



来源:https://stackoverflow.com/questions/30855988/ancient-delphi-vcl-app-looks-to-have-no-windows-theme-or-vcl-style

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