2013-06-21 24 views
0

我的應用程序(德爾福7寫)相關的正確運行在Windows XP SP3,但是當我嘗試在Windows 7上運行它出現此異常:如何解決EInvalidOperation到圖像列表

EInvalidOperation與信息「無效的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); 

    ... 
    ... 

模塊dmImages已正確創建,如frMain,但是當 意願創建對象FR ameAnagrafica然後引發異常的構造方法:

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時出現問題。 我該如何解決這個問題?

+0

也許你可以顯示你的一些代碼。否則,我們的幫助希望就破滅了。 – lurker

+1

什麼版本的Delphi?圖像列表中有哪些類型的圖像?它們如何被加載到圖像列表中?如果您希望我們爲您提供幫助,您需要具體說明並提供詳細信息。我們無法看到您的代碼,無法讀懂您的想法,也無法訪問您的計算機以便從此處爲您進行調試,因此我們只能使用您提供給我們的信息來提供幫助。請[編輯]您的問題並提供更多信息。謝謝。 –

+0

你在問我們什麼? –

回答

1

如果對當前操作系統不支持的屬性ColorDepth使用值,則可能會發生此類異常。或者,如果您嘗試使用帶Alpha通道的32Bit圖像列表(TColorDepth.cd32Bit),但在您的應用程序中沒有XP清單,則可能發生這種情況。爲此,請將xpman單元包含在您的項目中,或在「項目>選項>應用程序>外觀>運行時主題」中選擇「啓用運行時主題」,然後選擇Delphi XE2或更高版本。

+0

我試圖刪除主窗體上的控件XPManifest,並且應用程序運行correclty。 – Alberto

+0

比刪除XP清單更好的是讓圖像列表與XP及更高版本兼容。沒有XP清單會導致某些庫在Windows 2000版本中加載,主題將被關閉。 –

0

我剛剛從Windows 10收到更新,它搞砸了我的機器,它奪走了我的文件夾的權限。我目前正在運行Delphi,當我試圖打印報告時,出現錯誤消息Class Elnvalidoperation無法生成報告。這是因爲我的打印機消失了,我不得不重新安裝,問題似乎已經解決。

相關問題