delphi 5 apps display something wrong on the panel in win7 x64
I moved the delphi 5 app to win 7 x64. But I saw the panel didn't show as well as it was in Win XP. I tried to fix the height and resize in the OnResize, but failed. Let's say there are 2 panels in a form, panel1 and panel2. panel1.align=alleft and panel2.align=alclient. panel2 is in panel1. b开发者_JAVA百科ut in Win 7 x64, the panel2 didn't full fill its parent. is this because the delphi is too old that i need to change a new version?
I have seen something like this, althought usually some more complicated layout is involved than just two panels. Adding few panel.Realign;
calls in appropriate places (ie in form's OnShow
event) have fixed it for me.
I think such issues occurred when a form is displayed on screen, with its state as maximized. Is it your case?
What I've done to fix it is that I created the form not as maximized, but on screen center, then add a custom message just after the form is shown:
TMyForm = class(TForm)
(...)
procedure WMUser(var Msg: TMessage); message WM_USER;
(...)
procedure TMyForm .FormShow(Sender: TObject);
begin
(...)
PostMessage(Handle,WM_USER,0,0); // avoid Vista and Seven screen refresh bug
end;
procedure TMyForm .WMUser(var Msg: TMessage);
begin
WindowState := wsMaximized;
end;
精彩评论