If I create a new Delphi form, hook its OnResize event, and run the app, OnResize is fired before the window is shown. What I don't know is whether this will always happen, for any window.
(For anyone familiar with the Windows API, I've traced it to the ShowWindow call in TCustomForm.ShowingChanged (Forms.pas line 5503 in Delphi 2007), which apparently triggers a WM_SIZE
... at least, for a new window with no other properties set. I haven't seen it documented that ShowWindow always fires WM_SIZE
, so I don't know whether I can count on this or not.)
So: Can I rely on a TForm always firing OnResize when it's first shown? Or are there circumstances (maybe if the window is non-resizable, maybe if the Position property has certain values, etc.) where OnResize might not fire before the window is first shown?