mjcarter22
asked on
Form slow to render
Hello,
I'm having problems with my applications's main form which is extremely slow to render when I go from minimize to maximize or change tabs. I'm using a ElPAgeControl (all client) and Eldos components and buttons on the tabs. It is even visually slow in the IDE. The EL coponents are all XP enabled but that does not seem to be the problem as I turned the XP off and it was still slow.
Would anybody know what the problem may be or if there are any tricks I can do to make it render faster? Right now you can see the components appear one by one as if you were loading a web page through a dialup connection.
THanks
You could try setting the doublebuffered property of the form so that it renders it all in one go first before displaying.
ASKER
Thanks for your response mikelittlewood
I tried that and also set doublebuffered for all the other components. It helped a bit, but it still does the slow loading web page thing. It does not seem to load the entire Form before showing it. Is there anything else I need to set?
Is there a way that I can make the form invisible and then make it visible when everything is fully painted? Is there an event that is triggered when the painting is completed?
Maybe you could render the form off screen at some obscure coordinates and then move to centre of screen after a period of time. Im not sure what else you could do. Maybe someone else has some ideas.
As some possible tips, you should concentrate on drawing code optimization.
If you have some preaparing code (loading bitmaps etc) you should put it into the OnCreate event (or OnShow as apropriate) leaving paint events as lightweight as possible.
All painting happens only when it needs to be displayed - so when form is going to paint (when loading or restoring from minimized state), all controls are receving WM_PAINT message to paint on passed DC and all controls paints themselves one by one.
As some possible tips, you should concentrate on drawing code optimization.
If you have some preaparing code (loading bitmaps etc) you should put it into the OnCreate event (or OnShow as apropriate) leaving paint events as lightweight as possible.
All painting happens only when it needs to be displayed - so when form is going to paint (when loading or restoring from minimized state), all controls are receving WM_PAINT message to paint on passed DC and all controls paints themselves one by one.
You could also possibly put this in your dpr to stop the main form showing for a period of time
Application.ShowMainForm := False;
then do
Form1.Visible := true;
Application.ShowMainForm := True;
Application.ShowMainForm := False;
then do
Form1.Visible := true;
Application.ShowMainForm := True;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks gandalf_the_white,
You were right. The ELPack components were the problem. I switched to an older hard drive that also had Delphi on it with an older version of ELPAck and it compiled fine. The GUI refreshed normally.
You were right. The ELPack components were the problem. I switched to an older hard drive that also had Delphi on it with an older version of ELPAck and it compiled fine. The GUI refreshed normally.