LoginSignup
0
1

More than 5 years have passed since last update.

C++ Builder XE4 > TComponent > コントロールの拡大の検討 (Fontサイズ, ScaleBy)

Last updated at Posted at 2018-10-19
動作環境
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押下前

2018-10-19_11h40_22.png

Button1押下後

2018-10-19_11h41_17.png

拡大のされ方に一貫性がない。

確認 > 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押下前

2018-10-19_12h05_51.png

Button1押下後

2018-10-19_12h05_58.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1