Font.FromHdc 方法
从设备上下文的指定 Windows 句柄创建 Font。
**命名空间:**System.Drawing
**程序集:**System.Drawing(在 system.drawing.dll 中)
语法
声明
Public Shared Function FromHdc ( _
hdc As IntPtr _
) As Font
用法
Dim hdc As IntPtr
Dim returnValue As Font
returnValue = Font.FromHdc(hdc)
public static Font FromHdc (
IntPtr hdc
)
public:
static Font^ FromHdc (
IntPtr hdc
)
public static Font FromHdc (
IntPtr hdc
)
public static function FromHdc (
hdc : IntPtr
) : Font
参数
- hdc
设备上下文的句柄。
返回值
此方法创建的 Font。
异常
异常类型 | 条件 |
---|---|
指定的设备上下文的字体不是 TrueType 字体。 |
备注
若要使此方法生效,hdc 参数必须包含其中选定字体的设备上下文的句柄。此方法不能用于从 GDI+Graphics 对象获得的 hdc 句柄,因为此 hdc 句柄不会选定字体。
.NET Framework 安全性
- SecurityPermission 用于访问非托管代码。相关枚举:UnmanagedCode
平台
Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0