API version 1

- ‐

コンストラクタ

Fontオブジェクトを生成します。

呼出形式一覧

呼出形式

説明

new Font([string kind[, number size[, boolean bold[, boolean italic[, boolean underline[, boolean strikeout]]]]]])

Fontオブジェクトを生成します。

戻り値一覧

戻り値

説明

void

なし

引数一覧

引数

説明

kind

フォント名

省略時はOS標準フォントです。

size

フォントサイズ

省略時は10です。

bold

太字

省略時はfalseです。

italic

斜体

省略時はfalseです。

underline

下線

省略時はfalseです。

strikeout

打ち消し線

省略時はfalseです。

例外

なし

関連項目

bolditalickindsizestrikeoutunderline プロパティ



使用例 CRSダウンロード

Form Font_use {
   X = 0;
   Y = 0;
   Width = 790;
   Height = 530;

   /* 確認したい項目を入れてセットボタンを押します */
   TextBox txtKind {
           x = 29;
           y = 51;
           Width = 166;
           Height = 28;
   }
   ListBox lstKind {
           x = 29;
           y = 91;
           Width = 169;
           Height = 95;
           ListItem ListItem1[14] {

                   Function OnTouch( e ) {
                           ^.^.txtKind = this.title;
                   }
           }
   }
   Label Label13[2] {
           x = 79;
           y = 214;
           Width = 66;
           Height = 28;
           LayoutSpacing = 2;
           this[0].Value = "getWidth";
           this[1].Value = "getHeight";
   }
   TextBox txtGetSize[2] {
           x = 143;
           y = 208;
           Width = 54;
           Height = 28;
           LayoutSpacing = 2;
   }

   Button btnSet {
           x = 230;
           y = 106;
           Width = 75;
           Height = 43;
           Title = "Set";

           Function OnTouch( e ) {
                   var fon = new Font() ;
                   fon.kind = ^.txtKind.Value ;
                   fon.size = ^.txtSize.Value ;
                   fon.bold = ^.chkBold.Item1[0].Selected ;
                   fon.italic = ^.chkItalic.Item1[0].Selected ;
                   fon.underline = ^.chkUnder.Item1[0].Selected ;
                   fon.strikeout = ^.chkStrike.Item1[0].Selected ;

                   ^.TextBox1.Font = fon;
                   ^.Label12.Font = fon;
                   ^.Button1.font = fon;
                   ^.EditBox1.Font = fon;
                   ^.ListBox1.Font = fon;
                   ^.ComboBox1.Font = fon;
                   ^.txtGetSize[0] = fon.getWidth(^.TextBox1.Value);
                   ^.txtGetSize[1] = fon.getHeight();
           }
   }
   ComboBox ComboBox1 {
           x = 528;
           y = 225;
           Width = 153;
           Height = 27;
           ComboItem ComboItem1[3] {
                   Title = "コンボボックス";
           }
   }
   ListBox ListBox1 {
           x = 364;
           y = 183;
           Width = 119;
           Height = 78;
           ListItem ListItem1[5] {
                   Title = "リストボックス";
           }
   }
   EditBox EditBox1 {
           x = 547;
           y = 119;
           Width = 130;
           Height = 77;
           Value = "エディットボックス";
   }
   lstKind.ListItem1<<CSV(.title) {
           "Arial"
           "Courier New"
           "Helvetica"
           "Times New Roman"
           "MS ゴシック"
           "MS Pゴシック"
           "MS 明朝"
           "MS P明朝"
           "メイリオ"
           "Meiryo UI"
           "游ゴシック"
           "游明朝"
           "ヒラギノ角ゴ ProN W3"
   };
   Label Label11 {
           x = 234;
           y = 33;
           Width = 54;
           Height = 17;
           Value = "size";
   }
   TextBox txtSize {
           x = 230;
           y = 50;
           Width = 77;
           Height = 34;
   }
   CheckBox chkBold {
           x = 237;
           y = 166;
           Width = 106;
           Height = 28;
           Border = BORDER_NONE;
           CheckItem Item1[1] {
                   Height = 25;
                   Title = "Bold";
                   Width = 95;
                   Selected = 0;
                   y = 2;
           }
   }
   CheckBox chkItalic {
           x = 237;
           y = 193;
           Width = 84;
           Height = 28;
           Border = BORDER_NONE;
           CheckItem Item1[1] {
                   Height = 25;
                   Title = "Italic";
                   Width = 75;
                   Selected = 0;
           }
   }
   CheckBox chkUnder {
           x = 237;
           y = 221;
           Width = 93;
           Height = 28;
           Border = BORDER_NONE;
           CheckItem Item1[1] {
                   Height = 25;
                   Title = "Underline";
                   Width = 84;
                   Selected = 0;
           }
   }
   CheckBox chkStrike {
           x = 237;
           y = 249;
           Width = 88;
           Height = 28;
           Border = BORDER_NONE;
           CheckItem Item1[1] {
                   Height = 25;
                   Title = "Strikeout";
                   Width = 84;
                   Selected = 0;
           }
   }
   TextBox TextBox1 {
           x = 359;
           y = 49;
           width = 142;
           height = 55;
           Value = "テキストボックス";

           Function OnClicked( e ) {
                   try {
                           var fo = ^.TextBox1.Font;
                           ^.txtGetSize[0] = fo.getWidth(^.TextBox1.value);
                           ^.txtGetSize[1] = fo.getHeight();
                   }
                   catch(e) {
                           //.MessageBox("category: " + e.category + "\r\ncode: " +  str(e.code) + "\r\nmessage: " + e.message);
                   }
           }
   }
   Label Label12 {
           x = 546;
           y = 46;
           width = 128;
           height = 56;
           Border = BORDER_SUNKEN;
           Value = "ラベル";

           Function OnClicked( e ) {
                   try {
                           var fo = new Font();
                           ^.txtGetSize[0] = fo.getWidth(^.Label12.Value);
                           ^.txtGetSize[1] = fo.getHeight();
                   }
                   catch(e) {
                           //.MessageBox("category: " + e.category + "\r\ncode: " +  str(e.code) + "\r\nmessage: " + e.message);
                   }
           }
   }
   Button Button1 {
           x = 361;
           y = 120;
           width = 132;
           height = 47;
           Title = "ボタン";

           Function OnTouch( e ) {
                   try {
                           var fo = new Font();
                           ^.txtGetSize[0] = fo.getWidth(^.Button1.Title);
                           ^.txtGetSize[1] = fo.getHeight();
                   }
                   catch(e) {
                           //.MessageBox("category: " + e.category + "\r\ncode: " +  str(e.code) + "\r\nmessage: " + e.message);
                   }
           }
   }
}