Font.FromHdc(IntPtr) Font.FromHdc(IntPtr) Font.FromHdc(IntPtr) Font.FromHdc(IntPtr) Method

定義

從裝置內容的指定 Windows 控制代碼建立 FontCreates a Font from the specified Windows handle to a device context.

public:
 static System::Drawing::Font ^ FromHdc(IntPtr hdc);
public static System.Drawing.Font FromHdc (IntPtr hdc);
static member FromHdc : nativeint -> System.Drawing.Font
Public Shared Function FromHdc (hdc As IntPtr) As Font

參數

hdc
IntPtr IntPtr IntPtr IntPtr

裝置內容的控制代碼。A handle to a device context.

傳回

這個方法建立的 FontThe Font this method creates.

例外狀況

指定之裝置内容的字型不是 TrueType 字型。The font for the specified device context is not a TrueType font.

備註

若要讓此方法正常執行hdc , 參數必須包含已選取字型之裝置內容的控制碼。For this method to work, the hdc parameter must contain a handle to a device context in which a font is selected. 這個hdc方法不會使用GDI+GDI+ Graphics從物件取得的控制碼, 因為hdc控制碼並未選取字型。This method will not work with an hdc handle acquired from a GDI+GDI+ Graphics object because the hdc handle does not have a font selected.

安全性

SecurityPermission
用於存取未受管理的程式碼。for access to unmanaged code. 相關列舉:UnmanagedCodeRelated enumeration: UnmanagedCode

適用於