Board index » cppbuilder » Maximize to fix size and not to full screen, how?

Maximize to fix size and not to full screen, how?


2004-02-08 08:31:03 PM
cppbuilder78
Hi, i want that when the user press the 'Maximize' icon of the
form, the form will be enlarge but to the size that i want, for
example: 700 x 1200 and not streaching to the full size of the
screen as it's usually happen.
How do i do that? Thanks :-)
Ami
 
 

Re:Maximize to fix size and not to full screen, how?

Maybe something like this:
// Unit1.h
void __fastcall WndProc(TMessage &Msg);
// Unit1.cpp
void __fastcall TForm1::WndProc( TMessage &Msg )
{
if ( Msg.Msg == WM_SYSCOMMAND)
if ( Msg.WParam == SC_MAXIMIZE )
{
Form1->SetBounds(0, 0, 700, 1200);
return;
}
TForm::WndProc( Msg );
}
 

Re:Maximize to fix size and not to full screen, how?

Thanks, i'll give it a try.
"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote:
Quote
Maybe something like this:
// Unit1.h
void __fastcall WndProc(TMessage &Msg);

// Unit1.cpp
void __fastcall TForm1::WndProc( TMessage &Msg )
{
if ( Msg.Msg == WM_SYSCOMMAND)
if ( Msg.WParam == SC_MAXIMIZE )
{
Form1->SetBounds(0, 0, 700, 1200);
return;
}
TForm::WndProc( Msg );
}
 

{smallsort}

Re:Maximize to fix size and not to full screen, how?

"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote in message
Quote
if ( Msg.Msg == WM_SYSCOMMAND)
if ( Msg.WParam == SC_MAXIMIZE )
A better approach would be to intercept the WM_GETMINMAXINFO message
instead:
void __fastcall TForm1::WndProc(TMessage &Message)
{
TForm::WndProc(Message);
if( Message.Msg == WM_GETMINMAXINFO )
{
LPMINMAXINFO pInfo =
reinterpret_cast<LPMINMAXINFO>(Message.LParam);
pInfo->ptMaxSize = Point(700, 1200);
}
}
Gambit