Preview Window Sizing
When I try to change the border icons on the preview window and then do a
WindowState := wsMaximized the preview window does not take into account the
height of the system task bar. Has anyone else seen this and is there an
easy fix?
What I'm doing is disabling the min/max buttons and leaving only the close
button on the title bar so they can close the window but not minimize or
maximize it.
David Looney
WindowState := wsMaximized the preview window does not take into account the
height of the system task bar. Has anyone else seen this and is there an
easy fix?
What I'm doing is disabling the min/max buttons and leaving only the close
button on the title bar so they can close the window but not minimize or
maximize it.
David Looney
This discussion has been closed.
Comments
when the form is created. One way to get around this is by sizing the
preview window yourself in the OnResize callback for the form. Below is some
sample come that will maximize the preview window, remove the minimize and
maximize buttons, and resize it to fill the available desktop area.
----------------------------------------------------------------------------
--------------
procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);
begin
ppReport1.PreviewForm.WindowState := wsMaximized;
TppViewer(ppReport1.PreviewForm.Viewer).ZoomSetting := zs100Percent;
{ we only want the close button }
ppReport1.PreviewForm.BorderIcons := [biSystemMenu];
{ assign the resize event handler }
ppReport1.PreviewForm.OnResize := FormResize;
end;
procedure TForm1.FormResize(Sender: TObject);
var
lRect: TRect;
begin
{ system call to retrieve available desktop area }
SystemParametersInfo(SPI_GETWORKAREA, 0, @lRect, 0);
{ set the size of the form to the available area }
ppReport1.PreviewForm.Top := 0;
ppReport1.PreviewForm.Left := 0;
ppReport1.PreviewForm.Width := lRect.right - lRect.left;
ppReport1.PreviewForm.Height := lRect.bottom - lRect.top;
end;
----------------------------------------------------------------------------
---------------------------
--
Cheers,
Alexander Kramnik
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com