Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 389
  • Last Modified:

Form slow to render

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.


  • 3
  • 2
1 Solution
You could try setting the doublebuffered property of the form so that it renders it all in one go first before displaying.
mjcarter22Author Commented:

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.

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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;
if it is visually slow in the ide
then it shouldnt be your code.

one possible way to identify what makes the form slow
is to copy the whole project and then delete in copy one component after
if the form is starting to get faster with each component then the
components all are responsible for making it slower.
but maybe there is one component that is the reason it
takes so much time.
mjcarter22Author Commented:
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.


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now