0

私のアプリケーション (Delphi 7 で作成) は Windows XP SP3 で正しく動作しますが、Windows 7 で実行しようとすると、次の例外が発生します。

EInvalidOperation とメッセージ「Invalid ImageList」

これはメインのアプリケーション コードです。

  Application.Initialize;

  tmpSplash.GoNextMsg;
  Application.CreateForm(TdmImages, dmImages);

  tmpSplash.GoNextMsg; // Collegamento database
  Application.CreateForm(TdmCharter, dmCharter);


  tmpSplash.GoNextMsg; // Caricamento immagini
  Application.CreateForm(TfrMain, frMain);

  tmpSplash.GoNextMsg; // init: Anagrafica
  frameAnagrafica := TframeAnagrafica.Create(Application);

  tmpSplash.GoNextMsg; // init: Flotta
  frameFlotta := TframeFlotta.Create(Application);
  //Application.CreateForm(TframeFlotta, frameFlotta);

  ...
  ...

frMain などのモジュール dmImages は正しく作成されていますが、オブジェクト frameAnagrafica が作成されると、コンストラクター メソッドで例外が発生します。

type
    TframeAnagrafica = class(TMyCustomFrame)
...
...

{$R *.dfm}
constructor TframeAnagrafica.Create(AOwner: TComponent);
begin
  inherited Create(AOwner); 

end;

TframeAnagrafica の「スーパークラス」:

TMyCustomFrame = class(TFrame)
...
...

{$R *.dfm}

constructor TMyCustomFrame.Create(AOwner: TComponent);
begin
  inherited Create(AOwner); <-- Exception here

end;

Windows XP では問題ありませんが、Windows 7 を使用すると問題が発生します。この問題を解決するにはどうすればよいですか?

4

2 に答える 2

1

ColorDepth現在のオペレーティング システムでサポートされていないプロパティの値を使用すると、このような例外が発生する可能性があります。または、アルファ チャネル ( TColorDepth.cd32Bit) を持つ 32 ビット イメージリストを使用しようとしたが、アプリケーションに XP マニフェストがない場合に発生する可能性があります。これを行うには、ユニットxpmanをプロジェクトに含めるか、[プロジェクト] > [オプション] > [アプリケーション] > [外観] > [ランタイム テーマ] ind Delphi XE2 以降で [ランタイム テーマを有効にする] を選択します。

于 2013-06-27T13:04:46.357 に答える