Controlling Form Maximization

Creating a Form Like the Top BCB IDE

The top section of Borland C++ Builder (and Delphi) is an example of a form that has a fixed maximum height when it gets resized. To control the maximum dimensions of a form when it gets maximized, you can implement a procedure that declares and sets the properties of the MINMAXINFO structure.

In the form header, declare a WndProc() procedure as follows:

virtual void __fastcall WndProc(TMessage &Msg);

In the source file, implement the procedure as follows:

//---------------------------------------------------------------------------
void __fastcall TForm1::WndProc(TMessage &Msg)
{
    switch(Msg.Msg)
    {
    case WM_GETMINMAXINFO:
        LPMINMAXINFO lpMMI;
        lpMMI = reinterpret_cast<LPMINMAXINFO>(Msg.LParam);
        lpMMI->ptMaxTrackSize.y = 110;
        break;
    }

    TForm::WndProc(Msg);
}
//---------------------------------------------------------------------------

 

 


Copyright © 2003-2007 FunctionX, Inc.