Share via


FontFamily::IsStyleAvailable-Methode (gdiplusheaders.h)

Die FontFamily::IsStyleAvailable-Methode bestimmt, ob die angegebene Formatvorlage für diese Schriftfamilie verfügbar ist.

Syntax

BOOL IsStyleAvailable(
  [in] INT style
);

Parameter

[in] style

Typ: INT

Ganzzahl, die den Stil der Schriftart angibt. Dieser Wert muss ein Element der FontStyle-Enumeration oder das Ergebnis eines bitweisen OR sein, das auf zwei oder mehr dieser Elemente angewendet wird. Gibt beispielsweise FontStyleBold | FontStyleUnderline | FontStyleStrikeout eine Kombination der drei Stile an.

Rückgabewert

Typ: BOOL

Wenn der Stil oder die Kombination von Formaten verfügbar ist, gibt diese Methode TRUE zurück. Andernfalls wird FALSE zurückgegeben.

Hinweise

Diese Methode gibt ein irreführendes Ergebnis für einige Schriftarten von Drittanbietern zurück. Beispielsweise kann false zurückgegeben werden, IsStyleAvailable(FontStyleUnderline) da es sich wirklich um eine normale Schriftart handelt, die auch eine unterstrichene Schriftart ist: . (FontStyleRegular | FontStyleUnderline) Wenn die Schriftart keinen regulären Stil aufweist, gibt die IsStyleAvailable-Methode FALSE zurück.

Beispiele

Im folgenden Beispiel wird ein FontFamily-Objekt erstellt. Wenn für die Schriftfamilie eine reguläre Formatvorlage verfügbar ist, zeichnet das Beispiel Text.

VOID Example_IsStyleAvailable(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a FontFamily object.
   FontFamily myFontFamily(L"arial");
   
   // Check to see if the regular style is available.
   BOOL isStyleAvailable = myFontFamily.IsStyleAvailable(FontStyleRegular);

   // If regular style is available, draw text.
   if (isStyleAvailable)
   {
       SolidBrush solidbrush(Color(255, 0, 0, 0));
       Font       font(&myFontFamily, 16);
       WCHAR      string[100];
       swprintf_s(string, L"myFontFamily is available in regular style");
       graphics.DrawString(string,
                           wcslen(string), &font, PointF(0, 0), &solidbrush);
   }
}

Anforderungen

Anforderung Wert
Unterstützte Mindestversion (Client) Windows XP, Windows 2000 Professional [nur Desktop-Apps]
Unterstützte Mindestversion (Server) Windows 2000 Server [nur Desktop-Apps]
Zielplattform Windows
Kopfzeile gdiplusheaders.h (include Gdiplus.h)
Bibliothek Gdiplus.lib
DLL Gdiplus.dll

Weitere Informationen

Erstellen einer privaten Schriftartsammlung

FontFamily

FontStyle