OSFeature.Feature 属性
获取 OSFeature 类的 static 实例进行功能查询。此属性为只读。
**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)
语法
声明
Public Shared ReadOnly Property Feature As OSFeature
用法
Dim value As OSFeature
value = OSFeature.Feature
public static OSFeature Feature { get; }
public:
static property OSFeature^ Feature {
OSFeature^ get ();
}
/** @property */
public static OSFeature get_Feature ()
public static function get Feature () : OSFeature
属性值
一个 OSFeature。
备注
使用此 static 属性可查询操作系统功能。不能创建此类的实例。
若要确定功能的版本,请调用 GetVersionPresent 方法。若要确定某个功能或特定版本是否存在,请调用 IsPresent 方法,并使用该类中提供的功能标识符来指定要查找的功能。
示例
下面的示例向 OSFeature 查询 LayeredWindows 功能。检查版本是否为 空引用(在 Visual Basic 中为 Nothing),以确定该功能是否存在。结果显示在文本框内。此代码假定已经创建 textBox1
并将其放置在窗体上。
Private Sub LayeredWindows()
' Gets the version of the layered windows feature.
Dim myVersion As Version = _
OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows)
' Prints whether the feature is available.
If Not (myVersion Is Nothing) Then
textBox1.Text = "Layered windows feature is installed." & _
ControlChars.CrLf
Else
textBox1.Text = "Layered windows feature is not installed." & _
ControlChars.CrLf
End If
End Sub
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";
}
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 != nullptr )
{
textBox1->Text = "Layered windows feature is installed.\n";
}
else
{
textBox1->Text = "Layered windows feature is not installed.\n";
}
}
private void LayeredWindows()
{
// Gets the version of the layered windows feature.
Version myVersion = OSFeature.get_Feature().GetVersionPresent
(OSFeature.LayeredWindows);
// Prints whether the feature is available.
if (myVersion != null) {
textBox1.set_Text("Layered windows feature is installed.\n");
}
else {
textBox1.set_Text("Layered windows feature is not installed.\n");
}
} //LayeredWindows
平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、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
请参见
参考
OSFeature 类
OSFeature 成员
System.Windows.Forms 命名空间
OSFeature
Version
FeatureSupport 类
LayeredWindows