When I create a new VCL application with the New Item option to use the TMS FNC Ribbon Form for VCL and run the application it will cover the Windows task bar when the form is maximized (by clicking the maximize button when the application is running).
You can use the following code to workaround this. We'll investigate if we can add this internally
procedure TTMSFNCRibbonForm31.FormResize(Sender: TObject);
var
r: TRect;
begin
if WindowState = TWindowState.wsMaximized then
begin
SystemParametersInfo(SPI_GETWORKAREA, 0, @r,0) ;
SetBounds(r.Left, r.Top, r.Right-r.Left, r.Bottom-r.Top) ;
end;
end;
Thanks. I am not sure, but does this code also works correctly in a 2 monitor setup in which the monitors have different screen resolution dimensions? I am unable to test that scenario myself.
No this is for the primary monitor, for multi-monitor support, please use
uses
WinApi.MultiMon;
procedure TTMSFNCRibbonForm32.FormResize(Sender: TObject);
var
r: TRect;
MonInfo: TMonitorInfo;
begin
if WindowState = TWindowState.wsMaximized then
begin
MonInfo.cbSize := SizeOf(MonInfo);
if GetMonitorInfo(MonitorFromWindow(Handle, MONITOR_DEFAULTTONEAREST), @MonInfo) then
begin
r := MonInfo.rcWork;
SetBounds(r.Left, r.Top, r.Right - r.Left, r.Bottom - r.Top);
end;
end;
end;
TMS Data Modeler has the same problem:
Covers the task bar when maximized.
And if it's minimized, when I click to restore, it always return maximized.
I use it most with a 2 monitor environment.
There are some other weird window resizing problems.
The technique we use for the ribbon form is a borderless form and the issue is reproducible when using a default VCL application with BorderStyle set to bsNone.
After further investigation we came across the same solution each time, so the above workaround still stands. Alternatively, instead of inheriting from TMSFNCRibbonForm, use TForm, which will give back a border and maximize as expected.