動作環境
RAD Studio 10.2 Tokyo Update 3
Windows 10 v1903
概要
- フォームのHeight, Widthを指定
- => 期待していたサイズよりも小さい
- フォームのClientHeight, ClientWidthを指定
- => 期待していたサイズになる
実装
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)
{
Shape1->Width = 500;
Shape1->Height = 500;
this->Height = Shape1->Top + Shape1->Height + 10;
this->Width = Shape1->Left + Shape1->Width + 10;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Shape1->Width = 500;
Shape1->Height = 500;
this->ClientHeight = Shape1->Top + Shape1->Height + 10;
this->ClientWidth = Shape1->Left + Shape1->Width + 10;
}
//---------------------------------------------------------------------------
実行例
備考
Windows 7 + XE4では(Height, Width)で問題なかったような。
関連
- C++ Builder 10.2 Tokyo > Forms > Height > Windows 10: 実行タイミングによって異なる | Windows 7, 8.1: 実行タイミングによらず同じ > FormShow時とFormShow後
- winAppDev > Link > Windows 10 > invisible border > 1px: visible, 8px: invisible
- http://docwiki.embarcadero.com/Libraries/Rio/ja/Vcl.Forms.TForm.Height
-
http://docwiki.embarcadero.com/Libraries/Rio/ja/Vcl.Forms.TForm.ClientHeight
- 注記: 訳がおかしい
-
たとえば、フォームの ClientHeight は、Height プロパティ値からタイトル バー、サイズ変更したボーダー、スクロール バーの高さを引いたものにすることができます。
- 誤: にすることができます。
- 正: です。
-
- 注記: 訳がおかしい
-
http://docwiki.embarcadero.com/Libraries/Rio/en/Vcl.Forms.TForm.ClientHeight
-
For example, the ClientHeight of a form is the value of the Height property minus the height of the title bar, resize border, and scroll bars.
-
XE4 + Windows 7
XE4 + Windows 7でも同じ実装を試した。
同じ結果になった。
自分が勘違いしていたようだ。