Board index » delphi » Form resize with "Show window content" turned on.

Form resize with "Show window content" turned on.

Does anyone have a clue how to resize forms with a lot of controls avoiding
flicker.  This is with the "Show windows content while dragging"
(SPI_SETDRAGFULLWINDOWS) is set true.  My D5 apps flicker noticeably.  ...I
mean other than get a good graphics card. <G>

I'd like to perform like Outlook/Excel/Word.  D5 forms looks great too,
except for the content of the Object Inspector combo box as they are being
resized.

In fact, it seems that it is only really noticeable on TGroupBox captions
and THeaderControl section text.  TSpeedButton seems a lot worse than
TButton. (TGraphicControl? -- should be faster.).

Thanks,
Jim

 

Re:Form resize with "Show window content" turned on.


Well... Full window drag does not repaint the window at all! It takes a
"snapshot" (a image) of the window and moves that around the screen.
Therefore at the end of the drag everything looks "so fast" to you. Actualy
only the windows behind the one you drag receive pain commands... You can
simply test that... on the onpaint event of an object insert Sleep(1000);
which will force a 1 s dely in the repaint process (disregarding that you
move it or resize it) and test when you revive the paint commands... (of
course you can still use breakpoints... but this will explicitly slow down
the paint process).

Lusu.

Quote
"Jim Roberts" <rober...@aruplab.com> wrote in message

news:3bf464fe_1@dnews...
Quote
> Does anyone have a clue how to resize forms with a lot of controls
avoiding
> flicker.  This is with the "Show windows content while dragging"
> (SPI_SETDRAGFULLWINDOWS) is set true.  My D5 apps flicker noticeably.
...I
> mean other than get a good graphics card. <G>

> I'd like to perform like Outlook/Excel/Word.  D5 forms looks great too,
> except for the content of the Object Inspector combo box as they are being
> resized.

> In fact, it seems that it is only really noticeable on TGroupBox captions
> and THeaderControl section text.  TSpeedButton seems a lot worse than
> TButton. (TGraphicControl? -- should be faster.).

> Thanks,
> Jim

Re:Form resize with "Show window content" turned on.


Thanks Leontin.  I will try this test.  Something is going on because as the
form resizes several of the controls flash dramatically.  This is a resize
not a move.  It almost must be a repaint to my thinking because the
orientation of the control is changing with respect to the sides.  The form
is dilating while the controls remain the same size and move with respect to
their anchored sides. ..but then, I've been sure (and wrong) many times
before.  I clearly am not doing something that I could be.

Jim

Quote
"Leontin Birsan" <l...@creon.ro> wrote in message news:3bf4b0e5_2@dnews...
> Well... Full window drag does not repaint the window at all! It takes a
> "snapshot" (a image) of the window and moves that around the screen.
> Therefore at the end of the drag everything looks "so fast" to you.
Actualy
> only the windows behind the one you drag receive pain commands... You can
> simply test that... on the onpaint event of an object insert Sleep(1000);
> which will force a 1 s dely in the repaint process (disregarding that you
> move it or resize it) and test when you revive the paint commands... (of
> course you can still use breakpoints... but this will explicitly slow down
> the paint process).

Re:Form resize with "Show window content" turned on.


Quote
In article <3bf4b70f_2@dnews>, Jim Roberts wrote:
> I clearly am not doing something that I could be.

Hi Jim,

I'm not so sure this can be "fixed". The resizing, especially with
graphiccontrols, looks ugly. One could take the point of view that a
user who turns this option on, gets what (s)he deserves :). Most
applications look terrible when being resized under this option. Did
you try whether MyForm.DoubleBuffered:=true does any good? Didn't for
me.. What I've done is calculate the new positions/sizes of controls in
OnResize, but suspend setting of the new dimensions, just setting a
flag. Then in a WMNCHitTest handler (occurs when the user releases the
mouse in a resize) I really set the control's new bounds and clear the
flag. This is not an option with the VCL handling this, as in anchored
controls. In this case something like this is less flickery (Resized is
a field of the form):

procedure TForm1.FormResize(Sender: TObject);
begin
  if not Resized then
  begin
    Resized:=true;
    DisableAlign;
  end;
end;

procedure TForm1.WMNCHitTest(var msg: TMessage);
begin
  inherited;
  if Resized then
  begin
    Resized:=false;
    Enablealign;
  end;
end;

This basically undoes the user's setting, and might not be what (s)he
expects. Also, you have to be darned careful about calling disablealign
and enablealign in exactly matching pairs, as the VCL increases and
decreases an aligncount based on calling the commands.

If someone has a better idea, I'd be interested!

Renate

Other Threads