FontDialog.MinSize プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > FontDialog.MinSize プロパティの意味・解説 

FontDialog.MinSize プロパティ

ユーザー選択できるポイント サイズ最小値取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As FontDialog
Dim value As Integer

value = instance.MinSize

instance.MinSize = value
public int MinSize { get;
 set; }
/** @property */
public int get_MinSize ()

/** @property */
public void set_MinSize (int
 value)

プロパティ
ユーザー選択できるポイント サイズ最小値既定値は 0 です。

解説解説

ポイント サイズ最大値と最小値設定有効にするためには、MaxSize の値が MinSize の値よりも大きく、さらに両方の値が 0 より大きい値である必要があります

このプロパティの値を 0 より小さい値に設定しても、実際には 0 が使用されます。MinSizeMaxSize超える値を設定すると、MaxSizeMinSize設定されます。MinSize および MaxSize 同じ値に設定すると、選択できるフォント サイズ1 つ限定されます。

ポイント サイズを 0 にした場合は、フォント サイズ制限されません。

使用例使用例

MinSizeMaxSize、ShowEffects、FontMustExist の各メンバ使用する方法、および Apply イベント処理する方法次のコード例示します。この例を実行するには、FontDialog1 という名前の FontDialog と Button1 という名前の Button配置されているフォーム次のコード貼り付けます。

Private Sub Button1_Click(ByVal
 sender As System.Object, _
    ByVal e As System.EventArgs) Handles
 Button1.Click

    ' Set FontMustExist to true, which causes message box error
    ' if the user enters a font that does not exist. 
    FontDialog1.FontMustExist = True

    ' Set a minimum and maximum size to be
    ' shown in the FontDialog.
    FontDialog1.MaxSize = 32
    FontDialog1.MinSize = 18

    ' Show the Apply button in the dialog.
    FontDialog1.ShowApply = True

    ' Do not show effects such as Underline
    ' and Bold.
    FontDialog1.ShowEffects = False

    ' Save the existing font.
    Dim oldFont As System.Drawing.Font = Me.Font

    ' Show the dialog and save the result.
    Dim result As DialogResult = FontDialog1.ShowDialog()

    ' If The OK button in the Font dialog box is clicked, 
    ' set all the controls' fonts to the chosen font by
    ' calling the FontDialog1_Apply method.
    If result = DialogResult.OK Then
        FontDialog1_Apply(Me.Button1, New System.EventArgs)

        ' If the Cancel button is clicked, set the controls'
        ' fonts back to the original font.
    ElseIf (result = DialogResult.Cancel) Then
        Dim containedControl As Control
        For Each containedControl In
 Me.Controls
            containedControl.Font = oldFont
        Next

    End If
End Sub

' Handle the Apply event by setting all controls' fonts to 
' the chosen font. 
Private Sub FontDialog1_Apply(ByVal
 sender As Object, _
    ByVal e As System.EventArgs) Handles
 FontDialog1.Apply

    Me.Font = FontDialog1.Font
    Dim containedControl As Control
    For Each containedControl In
 Me.Controls
        containedControl.Font = FontDialog1.Font
    Next
End Sub
private void Button1_Click(System.Object sender,
 System.EventArgs e)
{
    // Set FontMustExist to true, which causes message box error
    // if the user enters a font that does not exist. 
    FontDialog1.FontMustExist = true;
    
    // Associate the method handling the Apply event with the event.
    FontDialog1.Apply += new System.EventHandler(FontDialog1_Apply);

    // Set a minimum and maximum size to be
    // shown in the FontDialog.
    FontDialog1.MaxSize = 32;
    FontDialog1.MinSize = 18;

    // Show the Apply button in the dialog.
    FontDialog1.ShowApply = true;

    // Do not show effects such as Underline
    // and Bold.
    FontDialog1.ShowEffects = false;
    
    // Save the existing font.
    System.Drawing.Font oldFont = this.Font;

    //Show the dialog, and get the result
    DialogResult result = FontDialog1.ShowDialog();
 
    // If the OK button in the Font dialog box is clicked, 
    // set all the controls' fonts to the chosen font by calling
    // the FontDialog1_Apply method.
    if (result == DialogResult.OK)
    {
        FontDialog1_Apply(this.Button1, new
 System.EventArgs());
    }
        // If Cancel is clicked, set the font back to
        // the original font.
    else if (result == DialogResult.Cancel)
    {
        this.Font = oldFont;
        foreach ( Control containedControl in
 this.Controls)
        {
            containedControl.Font = oldFont;
        }
    }
}

// Handle the Apply event by setting all controls' fonts to 
// the chosen font. 
private void FontDialog1_Apply(object sender,
 System.EventArgs e)
{

    this.Font = FontDialog1.Font;
    foreach ( Control containedControl in this.Controls
 )
    {
        containedControl.Font = FontDialog1.Font;
    }
}
void Button1_Click( System::Object^ sender, System::EventArgs^
 e )
{
   // Set FontMustExist to true, which causes message box error
   // if the user enters a font that does not exist. 
   FontDialog1->FontMustExist = true;
   
   // Associate the method handling the Apply event with the event.
   FontDialog1->Apply += gcnew System::EventHandler( this,
 &Form1::FontDialog1_Apply );
   
   // Set a minimum and maximum size to be
   // shown in the FontDialog.
   FontDialog1->MaxSize = 32;
   FontDialog1->MinSize = 18;
   
   // Show the Apply button in the dialog.
   FontDialog1->ShowApply = true;
   
   // Do not show effects such as Underline
   // and Bold.
   FontDialog1->ShowEffects = false;
   
   // Save the existing font.
   System::Drawing::Font^ oldFont = this->Font;
   
   //Show the dialog, and get the result
   System::Windows::Forms::DialogResult result = FontDialog1->ShowDialog();
   
   // If the OK button in the Font dialog box is clicked, 
   // set all the controls' fonts to the chosen font by calling
   // the FontDialog1_Apply method.
   if ( result == ::DialogResult::OK )
   {
      FontDialog1_Apply( this->Button1, gcnew System::EventArgs
 );
   }
   // If Cancel is clicked, set the font back to
   // the original font.
   else
   
   // If Cancel is clicked, set the font back to
   // the original font.
   if ( result == ::DialogResult::Cancel )
   {
      this->Font = oldFont;
      System::Collections::IEnumerator^ myEnum = this->Controls->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         Control^ containedControl = safe_cast<Control^>(myEnum->Current);
         containedControl->Font = oldFont;
      }
   }
}


// Handle the Apply event by setting all controls' fonts to 
// the chosen font. 
void FontDialog1_Apply( Object^ sender, System::EventArgs^ e )
{
   this->Font = FontDialog1->Font;
   System::Collections::IEnumerator^ myEnum1 = this->Controls->GetEnumerator();
   while ( myEnum1->MoveNext() )
   {
      Control^ containedControl = safe_cast<Control^>(myEnum1->Current);
      containedControl->Font = FontDialog1->Font;
   }
}
private void button1_Click(Object sender, System.EventArgs
 e)
{
    // Set FontMustExist to true, which causes message box error
    // if the user enters a font that does not exist. 
    fontDialog1.set_FontMustExist(true);
    // Associate the method handling the Apply event with the event.
    fontDialog1.add_Apply(new System.EventHandler(fontDialog1_Apply));
    // Set a minimum and maximum size to be
    // shown in the FontDialog.
    fontDialog1.set_MaxSize(32);
    fontDialog1.set_MinSize(18);
    // Show the Apply button in the dialog.
    fontDialog1.set_ShowApply(true);
    // Do not show effects such as Underline
    // and Bold.
    fontDialog1.set_ShowEffects(false);
    // Save the existing font.
    System.Drawing.Font oldFont = this.get_Font();
    //Show the dialog, and get the result
    DialogResult result = fontDialog1.ShowDialog();
    // If the OK button in the Font dialog box is clicked, 
    // set all the controls' fonts to the chosen font by calling
    // the fontDialog1_Apply method.
    if (result.Equals(get_DialogResult().OK)) {
        fontDialog1_Apply(this.button1, new
 System.EventArgs());
    }
    // If Cancel is clicked, set the font back to
    // the original font.
    else {
        if (result.Equals(get_DialogResult().Cancel)) {
            this.set_Font(oldFont);
            for (int iCtr = 0; iCtr < this.get_Controls().get_Count();
                iCtr++) {
                Control containedControl = this.get_Controls().
                    get_Item(iCtr);
                containedControl.set_Font(oldFont);
            }
        }
    }
} //button1_Click

// Handle the Apply event by setting all controls' fonts to 
// the chosen font. 
private void fontDialog1_Apply(Object sender,
 System.EventArgs e)
{
    this.set_Font(fontDialog1.get_Font());
    for (int iCtr = 0; iCtr < this.get_Controls().get_Count();
 
        iCtr++) {
        Control containedControl = this.get_Controls().get_Item(iCtr);
        containedControl.set_Font(fontDialog1.get_Font());
    }
} //fontDialog1_Apply
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

FontDialog.MinSize プロパティのお隣キーワード
検索ランキング

   

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



FontDialog.MinSize プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS