PowerTools PlusPak for Windows Forms 8.0J
FontTypes プロパティ
使用例 

GcFontPickerコントロールの選択可能なフォントをフィルタリングするために使用されるフォントタイプを取得または設定します。
構文
Public Property FontTypes As FilterFontTypes
public FilterFontTypes FontTypes {get; set;}

プロパティ値

FilterFontTypes値の1つ。デフォルトはFilterFontTypes.Allです。
例外
例外解説
System.ComponentModel.InvalidEnumArgumentException指定された値がFilterFontTypes値の1つではありません。
解説
このFontInfoFilterに関連付けられたGcFontPickerに表示されるフォントをフォントタイプでフィルタリングする場合は、このプロパティを、フィルタ表示するFilterFontTypes列挙体に割り当てます。そうすると、このFontInfoFilterに関連付けられたGcFontPickerAllFontsコレクションには指定したFilterFontTypesのフォントのみが格納され、ユーザーが選択するためのドロップダウンリストにはそれらのフォントの名前が表示されます。また、FilterFontTypesの組み合わせを指定してフィルタを実行することもできます。たとえば、このプロパティをFilterFontTypes.SymbolFontFilterFontTypes.MonospacedFontの組み合わせに設定した場合、AllFontsにはシンボルフォントとモノスペースフォントのみが格納され、これらのフォントの名前がドロップダウンリストに表示されます。
使用例

次のサンプルコードは、GcFontPicker.ItemFilterプロパティ上でFontTypesプロパティとCharSetsプロパティを設定して、GcFontPickerのドロップダウンリストのすべてのフォントグループに表示されるフォント名をフィルタリングします。この例では、OpenTypeフォントのうち日本語文字セットと簡体字中国語文字セットをサポートするフォントのみをすべてのフォントグループに表示しています。このサンプルコードを実行するには、以下のコードをSystem.Windows.Forms.Formプロジェクトに追加し、ここで作成したメソッドをコンストラクターまたはフォーム上の別のメソッドから呼び出します。

private void CreateGcFontPickerWithItemFilter()
{
    // Create an instance of GcFontPicker control.
    GcFontPicker gcFontPicker = new GcFontPicker();

    // Initialize the Name and Location of the gcFontPicker.
    gcFontPicker.Name = "gcFontPicker";
    gcFontPicker.Location = new Point(10, 50);

    // Set ItemFilter.
    gcFontPicker.ItemFilter.FontTypes = FilterFontTypes.OpenTypeFont;
    gcFontPicker.ItemFilter.CharSets = new CharSetCollection(new FontCharSet[] { FontCharSet.Japanese , FontCharSet.Chinese_Simplified});

    // adds gcFontPicker to the form.
    this.Controls.Add(gcFontPicker);
}
Private Sub CreateGcFontPickerWithItemFilter()
    ' Create an instance of GcFontPicker control.
    Dim gcFontPicker As New GcFontPicker()

    ' Initialize the Name and Location of the gcFontPicker.
    gcFontPicker.Name = "gcFontPicker"
    gcFontPicker.Location = New Point(10, 50)

    ' Set ItemFilter.
    gcFontPicker.ItemFilter.FontTypes = FilterFontTypes.OpenTypeFont
    gcFontPicker.ItemFilter.CharSets = New CharSetCollection(New FontCharSet() {FontCharSet.Japanese, FontCharSet.Chinese_Simplified})

    ' adds gcFontPicker to the form.
    Me.Controls.Add(gcFontPicker)
End Sub
プラットフォーム

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

参照

FontInfoFilter クラス
FontInfoFilter メンバ
FilterFontTypes 列挙体
FilterFontTypes 列挙体

Send Feedback