言語

Fonts.GetTypefaces メソッド

定義

指定したディレクトリの場所から Typeface オブジェクトのコレクションを返します。

オーバーロード

名前 説明
GetTypefaces(String)

フォント ディレクトリの場所を表す文字列値から Typeface オブジェクトのコレクションを返します。

GetTypefaces(Uri)

フォントの場所を表す URI (Uniform Resource Identifier) 値から Typeface オブジェクトのコレクションを返します。

GetTypefaces(Uri, String)

基本の UNIFORM リソース識別子 (URI) 値を使用して、フォントの場所を解決する Typeface オブジェクトのコレクションを返します。

GetTypefaces(String)

フォント ディレクトリの場所を表す文字列値から Typeface オブジェクトのコレクションを返します。

public:
 static System::Collections::Generic::ICollection<System::Windows::Media::Typeface ^> ^ GetTypefaces(System::String ^ location);
public static System.Collections.Generic.ICollection<System.Windows.Media.Typeface> GetTypefaces(string location);
static member GetTypefaces : string -> System.Collections.Generic.ICollection<System.Windows.Media.Typeface>
Public Shared Function GetTypefaces (location As String) As ICollection(Of Typeface)

パラメーター

location
String

フォントを含む場所。

返品

ICollection<T>のフォントを表すTypeface オブジェクトのlocation

例外

locationnull です。 このパラメーターはパスまたは URI として扱われるため、 nullを渡すことはできません。

次の例は、このメソッドを使用して、フォントの場所から Typeface オブジェクトのコレクションを返す方法を示しています。

foreach (Typeface typeface in Fonts.GetTypefaces("D:/MyFonts/"))
{
    // Perform action.
}
For Each typeface As Typeface In Fonts.GetTypefaces("D:/MyFonts/")
    ' Perform action.
Next typeface

適用対象

GetTypefaces(Uri)

フォントの場所を表す URI (Uniform Resource Identifier) 値から Typeface オブジェクトのコレクションを返します。

public:
 static System::Collections::Generic::ICollection<System::Windows::Media::Typeface ^> ^ GetTypefaces(Uri ^ baseUri);
public static System.Collections.Generic.ICollection<System.Windows.Media.Typeface> GetTypefaces(Uri baseUri);
static member GetTypefaces : Uri -> System.Collections.Generic.ICollection<System.Windows.Media.Typeface>
Public Shared Function GetTypefaces (baseUri As Uri) As ICollection(Of Typeface)

パラメーター

baseUri
Uri

フォントの場所のベース URI 値。

返品

ICollection<T>のフォントを表すTypeface オブジェクトのbaseUri

次の例は、このメソッドを使用して、ベース URI の場所から Typeface オブジェクトのコレクションを返す方法を示しています。

foreach (Typeface typeface in Fonts.GetTypefaces("file:///D:/MyFonts/"))
{
    // Perform action.
}
For Each typeface As Typeface In Fonts.GetTypefaces("file:///D:/MyFonts/")
    ' Perform action.
Next typeface

アプリケーションのリソース内の Typeface オブジェクトのコレクションを返すには、次の例に示す "pack://application" URI 表記を使用します。

foreach (Typeface typeface in Fonts.GetTypefaces(new Uri("pack://application:,,,/")))
{
    // Perform action.
}
For Each typeface As Typeface In Fonts.GetTypefaces(New Uri("pack://application:,,,/"))
    ' Perform action.
Next typeface

適用対象

GetTypefaces(Uri, String)

基本の UNIFORM リソース識別子 (URI) 値を使用して、フォントの場所を解決する Typeface オブジェクトのコレクションを返します。

public:
 static System::Collections::Generic::ICollection<System::Windows::Media::Typeface ^> ^ GetTypefaces(Uri ^ baseUri, System::String ^ location);
public static System.Collections.Generic.ICollection<System.Windows.Media.Typeface> GetTypefaces(Uri baseUri, string location);
static member GetTypefaces : Uri * string -> System.Collections.Generic.ICollection<System.Windows.Media.Typeface>
Public Shared Function GetTypefaces (baseUri As Uri, location As String) As ICollection(Of Typeface)

パラメーター

baseUri
Uri

フォントの場所のベース URI 値。

location
String

フォントを含む場所。

返品

解決されたフォント位置のフォントを表すICollection<T> オブジェクトのTypeface

次の例は、このメソッドを使用して、解決されたフォントの場所から Typeface オブジェクトのコレクションを返す方法を示しています。 この場合、アプリケーションには "resources" という名前のサブディレクトリが含まれています。

foreach (Typeface typeface in Fonts.GetTypefaces(new Uri("pack://application:,,,/"), "./resources/"))
{
    // Perform action.
}
For Each typeface As Typeface In Fonts.GetTypefaces(New Uri("pack://application:,,,/"), "./resources/")
    ' Perform action.
Next typeface

適用対象