Whenever selecting a new image or resizing the image through the
radiobuttons, a procedure of the frame will make the proper adjustments and
the TImage will be repainted, but that's not the question.
The question is how to make sure the procedure is called whenever the form
is resized, BUT only after it is finished resizing, in order to prevent
flicker. OnResize falls down on that respect as does the WMSize that calls
it. I know about WM_EXITSIZEMOVE (except how does one tell if they just
finished moving or resizing). I also know about WM_SYSCOMMAND (and the need
to mask the WParam) and WM_NCLBUTTONDBLCLK.
I suppose if I detect SC_RESTORE in the WM_SYSCOMMAND, I don't need to
create an OnRestore event handler for the Application.
Is there any other circumstance and solution that I am missing, regarding
resizing, maximizing or restoring of forms?
Does that really matter?
If so, you could simply save the form's width/height and compare the old
width/height to the form's new width/height.
Then you know if the form has been resized.
--
Finn Tolderlund
Only in that I find it a waste to run code for making adjustments for size
changes when the size hasn't changed.
> If so, you could simply save the form's width/height and compare the old
> width/height to the form's new width/height.
> Then you know if the form has been resized.
I discovered this works:
TfrmMain = class(TForm)
........
procedure WMEnterSizeMove(var Message: TMessage); message
WM_ENTERSIZEMOVE;
procedure WMExitSizeMove(var Message: TMessage); message
WM_EXITSIZEMOVE;
private
{ Private declarations }
LastSize: TRect;
public
{ Public declarations }
end;
....................
procedure TfrmMain.WMEnterSizeMove(var Message: TMessage);
begin
CopyRect(LastSize, ClientRect);
end;
procedure TfrmMain.WMExitSizeMove(var Message: TMessage);
begin
If Not EqualRect(ClientRect, LastSize) Then
{ your code to adjust for size changes }
end;
Since ClientRect is always (0, 0, ClientWidth, ClientHeight), it will only
change if the size has changed, not the position.
"Mark Reichert" <ma...@messagelink.com> skrev i en meddelelse
news:459d5825$1...@newsgroups.borland.com...
> "Finn Tolderlund" <n...@spam.com> wrote in message
> news:459c0ca3$1...@newsgroups.borland.com...
>> If so, you could simply save the form's width/height and compare the old
>> width/height to the form's new width/height.
>> Then you know if the form has been resized.
>
> I discovered this works: