Font Sizeとは? わかりやすく解説

Font.Size プロパティ

この Fontem サイズを、Unit プロパティ指定した単位取得します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

使用例使用例

Font コンストラクタSize、SizeInPoints、および Unit の各プロパティ使用する方法次のコード例示します。この例は、ComboBox1 という名前の ComboBox に "Bigger" と "Smaller" という文字列設定されWindows フォームでの使用意図してデザインされています。そして、次のコードをそのフォーム貼り付けComboBox1_SelectedIndexChanged メソッドに、ComboBox コントロールの SelectedIndexChanged イベント関連付けます。

Private Sub ComboBox1_SelectedIndexChanged(ByVal
 sender As System.Object, _
    ByVal e As System.EventArgs) Handles
 ComboBox1.SelectedIndexChanged

    ' Cast the sender object back to a ComboBox.
    Dim ComboBox1 As ComboBox = CType(sender,
 ComboBox)

    ' Retrieve the selected item.
    Dim selectedString As String
 = CType(ComboBox1.SelectedItem, String)

    ' Convert it to lowercase.
    selectedString = selectedString.ToLower()

    ' Declare the current size.
    Dim currentSize As Single

    ' Switch on the selected item. 
    Select Case selectedString

        ' If Bigger is selected, get the current size from the 
        ' Size property and increase it. Reset the font to the
        '  new size, using the current unit.
    Case "bigger"
            currentSize = Label1.Font.Size
            currentSize += 2.0F
            Label1.Font = New Font(Label1.Font.Name, currentSize,
 _
                Label1.Font.Style, Label1.Font.Unit)

            ' If Smaller is selected, get the current size, in points
,
            ' and decrease it by 1.  Reset the font with the new size
            ' in points.
        Case "smaller"
            currentSize = Label1.Font.SizeInPoints
            currentSize -= 1
            Label1.Font = New Font(Label1.Font.Name, currentSize,
 _
                Label1.Font.Style)
    End Select
End Sub
private void ComboBox1_SelectedIndexChanged(System.Object
 sender, 
    System.EventArgs e)
{

    // Cast the sender object back to a ComboBox.
    ComboBox ComboBox1 = (ComboBox) sender;

    // Retrieve the selected item.
    string selectedString = (string) ComboBox1.SelectedItem;

    // Convert it to lowercase.
    selectedString = selectedString.ToLower();

    // Declare the current size.
    float currentSize;

    // Switch on the selected item. 
    switch(selectedString)
    {

            // If Bigger is selected, get the current size from the
 
            // Size property and increase it. Reset the font to the
            //  new size, using the current unit.
        case "bigger":
            currentSize = Label1.Font.Size;
            currentSize += 2.0F;
            Label1.Font = new Font(Label1.Font.Name, currentSize,
 
                Label1.Font.Style, Label1.Font.Unit);

            // If Smaller is selected, get the current size, in points
,
            // and decrease it by 1.  Reset the font with the new size
            // in points.
            break;
        case "smaller":
            currentSize = Label1.Font.SizeInPoints;
            currentSize -= 1;
            Label1.Font = new Font(Label1.Font.Name, currentSize,
 
                Label1.Font.Style);
            break;
    }
}
private:
    void ComboBox1_SelectedIndexChanged(System::Object^ sender
,
        System::EventArgs^ e)
    {

        // Cast the sender object back to a ComboBox.
        ComboBox^ ComboBox1 = (ComboBox^) sender;

        // Retrieve the selected item.
        String^ selectedString = (String^) ComboBox1->SelectedItem;

        // Convert it to lowercase.
        selectedString = selectedString->ToLower();

        // Declare the current size.
        float currentSize;

        // If Bigger is selected, get the current size from the 
        // Size property and increase it. Reset the font to the
        //  new size, using the current unit.
        if (selectedString == "bigger")
        {
            currentSize = Label1->Font->Size;
            currentSize += 2.0F;
            Label1->Font =gcnew System::Drawing::Font(Label1->Font->Name,
 
                currentSize, Label1->Font->Style, Label1->Font->Unit);

        }
        // If Smaller is selected, get the current size, in
        // points, and decrease it by 2.  Reset the font with
        // the new size in points.
        if (selectedString == "smaller")
        {
            currentSize = Label1->Font->Size;
            currentSize -= 2.0F;
            Label1->Font = gcnew System::Drawing::Font(Label1->Font->Name,
 
                currentSize, Label1->Font->Style);

        }
    }
private void comboBox1_SelectedIndexChanged(Object
 sender, 
    System.EventArgs e)
{
    // Cast the sender object back to a ComboBox.
    ComboBox comboBox1 = (ComboBox)sender;
    // Retrieve the selected item.
    String selectedString = (String)comboBox1.get_SelectedItem();
    // Convert it to lowercase.
    selectedString = selectedString.ToLower();
    // Declare the current size.
    float currentSize;
    // Switch on the selected item. 
    // If Bigger is selected, get the current size from the 
    // Size property and increase it. Reset the font to the
    //  new size, using the current unit.
    if (selectedString.Equals("bigger")) {
        currentSize = label1.get_Font().get_Size();
        currentSize += 2;
        label1.set_Font(new Font(label1.get_Font().get_Name(),
 
            currentSize, label1.get_Font().get_Style(), 
            label1.get_Font().get_Unit()));
    }
    else {
        // If Smaller is selected, get the current size, in points,
        // and decrease it by 1.  Reset the font with the new size
        // in points.
        if (selectedString.Equals("smaller")) {
            currentSize = label1.get_Font().get_SizeInPoints();
            currentSize -= 1;
            label1.set_Font(new Font(label1.get_Font().get_Name(),
 
                currentSize, label1.get_Font().get_Style()));
        }
    }
} //comboBox1_SelectedIndexChanged
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

FontSize 列挙体

レンダリングするテキストサイズ指定します。このクラス継承できません。

名前空間: System.Web.UI.MobileControls
アセンブリ: System.Web.Mobile (system.web.mobile.dll 内)
構文構文

メンバメンバ
解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
System.Web.UI.MobileControls 名前空間
System.Web.UI.WebControls.FontSize

FontSize 列挙体

HTML 4.0定義するフォント サイズ指定します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

メンバメンバ
解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
System.Web.UI.WebControls 名前空間
FontUnit
Type



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Font Size」の関連用語

Font Sizeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Font Sizeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS