i try maximize width , hold height. use delphi xe4, windows 7, 1,440 * 900 2 monitors.
height constraint works when exceeds value 859 doesn't work.
i guessed because of windows snap feature after turning off it's same.
when in sub monitor doesn't have taskbar , in main monitor taskbar auto hide works well. seems trouble taskbar.
any solve please. thanks.
procedure tform1.button1click(sender: tobject); begin constraints.maxheight := 859; // works windowstate := wsmaximized; caption := inttostr(height); end; procedure tform1.button2click(sender: tobject); begin constraints.maxheight := 860; // doesn't work windowstate := wsmaximized; caption := inttostr(height); // maximized 876 end; procedure tform1.formconstrainedresize(sender: tobject; var minwidth, minheight, maxwidth, maxheight: integer); begin maxheight := 860; // doesn't works , maximized 876 end;
if trying restrict maximum size of form when user tries maximise work. have own form class descended tform
called trgnewform
, forms descend that. scheme work form put code in.
in interface
section, in form class public definition
{ trap sys commands } procedure wmsyscommand (var msg: twmsyscommand); message wm_syscommand;
in implementation
procedure trgnewform.wmsyscommand (var msg : twmsyscommand); begin { if mdichild , maximize button pressed, use our own routine, windows has bug } if (msg.cmdtype = sc_maximize) , (formstyle = fsmdichild) maximise_child_form else defaulthandler (msg); end;
in maximise_child_form
set height , width required.