VisualStyleRenderer.GetFont(IDeviceContext, FontProperty) 方法

定义

返回当前视觉样式元素的指定字体属性的值。Returns the value of the specified font property for the current visual style element.

public:
 System::Drawing::Font ^ GetFont(System::Drawing::IDeviceContext ^ dc, System::Windows::Forms::VisualStyles::FontProperty prop);
public System.Drawing.Font GetFont (System.Drawing.IDeviceContext dc, System.Windows.Forms.VisualStyles.FontProperty prop);
member this.GetFont : System.Drawing.IDeviceContext * System.Windows.Forms.VisualStyles.FontProperty -> System.Drawing.Font
Public Function GetFont (dc As IDeviceContext, prop As FontProperty) As Font

参数

dc
IDeviceContext

此操作将使用的 IDeviceContextThe IDeviceContext this operation will use.

prop
FontProperty

FontProperty 值之一,指定要为当前视觉样式元素检索的属性值。One of the FontProperty values that specifies which property value to retrieve for the current visual style element.

返回

Font,它包含 prop 参数为当前视觉样式元素指定的属性的值。A Font that contains the value of the property specified by the prop parameter for the current visual style element.

异常

dcnulldc is null.

prop 不是 FontProperty 值之一。prop is not one of the FontProperty values.

注解

视觉样式使用一组字体值来描述样式定义的元素的某些属性。Visual styles use a set of font values to describe some properties of the elements defined by a style. 这些属性由 FontProperty 值封装。These properties are encapsulated by the FontProperty values.

适用于