Главная страница | назад





Article #17389: How do I get a Form's width to be less than 120 (approx) pixels?

 Question and Answer Database
FAQ2389C.txt How do I get a Form's width to be less than 120 (approx) pixels?
Category :VCL
Platform :All
Product :C++Builder 3.x
Question:
How do I get a Form's width to be less than 120 (approx) pixels?
Answer:
This is controlled and overridden by Windows. Under some versions
of Windows, you may be successful by creating a message handler to
respond to the WM_GETMINMAXINFO message:
Example:
Place this code in the public section of the Form declaration:
//this is the function to handle the message
void virtual __fastcall FixedFormSize(TWMGetMinMaxInfo& Msg);
//Mapping function for the Message
BEGIN_MESSAGE_MAP
MESSAGE_HANDLER(WM_GETMINMAXINFO,TWMGetMinMaxInfo,FixedFormSize)
// Add any number of additional message handlers here.
END_MESSAGE_MAP(TForm)
Place this code in the Form implementation section:
void __fastcall TForm1::FixedFormSize(TWMGetMinMaxInfo& Msg)
{
TForm::Dispatch(&Msg);
//you can set the different min max values here
Msg.MinMaxInfo->ptMaxSize.x = 40;
Msg.MinMaxInfo->ptMaxSize.y = 40;
Msg.MinMaxInfo->ptMaxTrackSize.x = 40;
Msg.MinMaxInfo->ptMaxTrackSize.y = 40;
}
For a more detailed axample, check the MsgMap example that ships with C++ Builder
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99