CropForms (C++)
Description
The following code determines the height of all forms on the screen and resizes any that are taller than the screen height.
Code
void __fastcall TForm1::Button1Click(TObject *Sender)
{
for (int i = 0; i < Screen->FormCount; i++)
{
if (Screen->Forms[i]->Top < 0)
{
Screen->Forms[i]->Height += Screen->Forms[i]->Top;
Screen->Forms[i]->Top = 0;
}
if (Screen->Forms[i]->Left < 0)
{
Screen->Forms[i]->Width += Screen->Forms[i]->Left;
Screen->Forms[i]->Left = 0;
}
if (Screen->Forms[i]->Left + Screen->Forms[i]->Width > Screen->Width)
Screen->Forms[i]->Width = Screen->Width - Screen->Forms[i]->Left;
if (Screen->Forms[i]->Top + Screen->Forms[i]->Height > Screen->Height)
Screen->Forms[i]->Height = Screen->Height - Screen->Forms[i]->Top;
}
}
Uses
- Vcl.Forms.TScreen.Height ( fr | de | ja )
- Vcl.Forms.TScreen.Width ( fr | de | ja )
- Vcl.Forms.Screen ( fr | de | ja )