


 
 
 
 
 
 
 |
DelphiXE3 [FMX] 電卓アプリケーション 2014/08/13 |
前回はカレンダー・アプリケーションを作ってみました。今回は簡易な電卓アプリケーションを作ってみます。
電卓(計算機)のアプリケーションは、OS内に標準で入っていますから、わざわざ作成する必要はないのですが(しかもOS標準の物の方が高機能!)、あくまでも Delphi・FireMonkey(FMX)でのテスト・プログラムを作ってみよう、という目的です。
ボタンは グリッドレイアウト(GridLayout) の上に配置しています。整然とタイルのように配置したい場合には、このグリッドレイアウトを利用するのが便利だと思います。
そして、画面をリサイズした場合に、ボタンの大きさ、文字の大きさを変更させたいと思います。ボタンの文字の大きさを変更したいので、オブジェクトインスペクタで Button1〜Button16 の StyledSettings.ssSize を「False」にしておきます。
procedure TForm1.FormResize(Sender: TObject);
var
i : integer;
cp: TComponent;
begin
GridLayout1.ItemWidth := GridLayout1.Width /4;
GridLayout1.ItemHeight:= GridLayout1.Height/4;
for i := 1 to 16 do begin
cp := FindComponent('Button'+IntToStr(i));
TButton(cp).Font.Size := GridLayout1.ItemHeight * 0.5;
end;
end; |
というわけで、ここでは、ボタンの文字の大きさは、ボタンの高さの 0.5倍としています。
プログラムは、若干、スパゲッティ化してしまいましたので、余り参考にならないかもしれません。。。
アイコンは、DelphiXE3 の提供するアイコンをそのまま使っています。
|
|
バッチファイル
BASIC
C言語のお勉強
拡張子な話
DOSプログラム
Delphi
>Dehi入門編
>Delphi2010
>DelphiXE3
▲2014/08/11
2014/08/13
▼2014/08/14
シェアウェア
Script!World
データベース
|