OSFeature.Feature 属性

定义

获取 OSFeature 类的 static 实例进行功能查询。 此属性为只读。

C#
public static System.Windows.Forms.OSFeature Feature { get; }

属性值

OSFeature 类的实例。

示例

以下示例查询OSFeatureLayeredWindows功能。 检查版本以查看它是否为 null,以确定功能是否存在。 结果显示在文本框中。 此代码假定 textBox1 已创建并放置在窗体上。

C#
private void LayeredWindows() {
   // Gets the version of the layered windows feature.
   Version myVersion =
       OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows);

   // Prints whether the feature is available.
   if (myVersion != null)
      textBox1.Text = "Layered windows feature is installed.\n";
   else
      textBox1.Text = "Layered windows feature is not installed.\n";
}

注解

使用此属性 static 查询操作系统功能。 无法创建此类的实例。

若要确定功能的版本,请 GetVersionPresent 调用 方法。 若要确定是否存在功能或特定版本,请调用 IsPresent 方法,并使用此类中提供的功能标识符指定要查找的功能。

适用于

产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

另请参阅