動作環境
C++ Builder XE4
参考
TLabel や TEdit などの一部のビジュアルコントロールは,コントロールのフォントサイズが変わると,自分自身のサイズを変更します。
確認 > v0.1
- Fontサイズ変更でのTComponentのサイズ変更
- ScaleBy()によるTCompoenntのサイズ変更
Unit1.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Edit1->Font->Size = 24;
Edit2->ScaleBy(150, 100);
Button3->Font->Size = 24;
Button2->ScaleBy(150, 100);
}
//---------------------------------------------------------------------------
結果
Button1押下前
Button1押下後
拡大のされ方に一貫性がない。
確認 > v0.2 : TPanel配置物の拡大
TPanel上の拡大について確認した。
Unit1.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Edit1->Font->Size = 24;
Edit2->ScaleBy(150, 100);
Button3->Font->Size = 24;
Button2->ScaleBy(150, 100);
// パネルサイズ変更
PNL_sample->ScaleBy(150, 100);
Edit4->Font->Size = 15;
Edit3->Font->Size = 15;
Button5->Font->Size = 15;
Button4->Font->Size = 15;
}
//---------------------------------------------------------------------------
Button1押下前
Button1押下後