画面表示 - フォント
フォントの幅、高さを取得したい
FontクラスのgetWidthメソッドでフォントの幅を、getHeightメソッドでフォントの高さを取得することができます。
※getWidthメソッドでは、引数に基準となる文字列を渡す必要があります。
【実行結果】
Form form1 { x = 0; y = 0; width = 907; height = 729; Font ft1 { kind = "Meiryo UI"; size = 20; } Label lb1{ x = 20; y = 20; width = 110; height = 40; Border = BORDER_PLANE; Value = "あいうえお"; Font = form1.ft1; } label lb2 { x = 17; y = 96; width = 288; height = 135; Border = BORDER_PLANE; Value = "ラベルの幅は" + str(^.lb1.width) + "、高さは" + str(^.lb1.height) + "\n「" + ^.lb1.value + "」の幅は" + str(^.ft1.getWidth(^.lb1.value)) + "、高さは" + str(^.ft1.getHeight()); } }
Biz-Collections Bizの宝箱 トップへ
Biz/Browser DT・Biz/Designer DT TIPS集 トップへ