Font.FromHdc(IntPtr) 方法

定义

Font从指定的 Windows 句柄创建设备上下文。

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

nativeint

设备上下文的句柄。

返回

此方法 Font 创建。

例外

指定设备上下文的字体不是 TrueType 字体。

注解

若要使此方法正常工作,参数 hdc 必须包含一个用于选择字体的设备上下文的句柄。 此方法不适用于 hdc 从 GDI+ Graphics 对象获取的句柄,因为 hdc 句柄未选择字体。

适用于