Code for executing the FormResize event

I tried several ways to force the FormResize event to fail without success, including SetWindowPos. The following code works very well when the form changes with the mouse, but I also need to call it manually with the code. I do not want the form to change in any way.

procedure TFormMain.FormResize( Sender: TObject );
begin
  dxDockPanelFolders1.Height := dxVertContainerDockSite1.Height div 3;
  dxDockPanelFiles1.Height := dxVertContainerDockSite1.Height div 3;
  dxDockPanelPreview1.Height := dxVertContainerDockSite1.Height div 3;
end;

In any case, I do not see to accomplish this when searching the Internet.

+3
source share
3 answers

Do you really need to fire the event, or is it enough if only the event handler is running? If so, just do

FormResize(Self);

If you really need to fire an event, just do

Resize;
0
source

I would use some indirectness:

procedure TFormMain.UpdateDockPanelLayout;
begin
  dxDockPanelFolders1.Height := dxVertContainerDockSite1.Height div 3;
  dxDockPanelFiles1.Height := dxVertContainerDockSite1.Height div 3;
  dxDockPanelPreview1.Height := dxVertContainerDockSite1.Height div 3;
end;

procedure TFormMain.FormResize(Sender: TObject);
begin
  UpdateDockPanelLayout;
end;

UpdateDockPanelLayout .

, FormResize Sender, - . , , , .

+5

Uh, just call

FormResize(nil);

When do you need to customize the controls?

-1
source

All Articles