OSFeature クラス
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
オペレーティング システム固有の機能についてのクエリを提供します。
public ref class OSFeature : System::Windows::Forms::FeatureSupport
public class OSFeature : System.Windows.Forms.FeatureSupport
type OSFeature = class
inherit FeatureSupport
Public Class OSFeature
Inherits FeatureSupport
- 継承
次の例では、 を使用 OSFeature してオペレーティング システムに対してクエリを実行し、機能が LayeredWindows インストールされているかどうかを判断します。 この例では、機能が存在するかどうかを確認する 2 つの異なる方法を示します。 最初のメソッドでは、 myVersion
が かどうかを確認します null
。 バージョン null
が の場合、この機能はインストールされません。 2 番目のメソッドでは、基本クラス メソッド IsPresent を呼び出して、機能がインストールされているかどうかを確認します。 結果はテキスト ボックスに表示されます。
このコードは、フォームが textBox1
作成され、フォームに配置されていることを前提としています。
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";
}
// This is an alternate way to check whether a feature is present.
if ( OSFeature::Feature->IsPresent( OSFeature::LayeredWindows ) )
{
textBox1->Text = String::Concat( textBox1->Text,
"Again, layered windows feature is installed." );
}
else
{
textBox1->Text = String::Concat( textBox1->Text,
"Again, layered windows feature is not installed." );
}
}
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';
// This is an alternate way to check whether a feature is present.
if (OSFeature.Feature.IsPresent(OSFeature.LayeredWindows))
textBox1.Text += "Again, layered windows feature is installed.";
else
textBox1.Text += "Again, layered windows feature is not installed.";
}
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 (myVersion IsNot Nothing) Then
textBox1.Text = "Layered windows feature is installed." & _
ControlChars.CrLf
Else
textBox1.Text = "Layered windows feature is not installed." & _
ControlChars.CrLf
End If
'This is an alternate way to check whether a feature is present.
If OSFeature.Feature.IsPresent(OSFeature.LayeredWindows) Then
textBox1.Text &= "Again, layered windows feature is installed."
Else
textBox1.Text &= "Again, layered windows feature is not installed."
End If
End Sub
プロパティで static
提供されているこのクラスのインスタンスを Feature 使用して、オペレーティング システム機能のクエリを実行します。 このクラスのインスタンスを作成することはできません。
機能のバージョンを確認するには、 メソッドを呼び出します GetVersionPresent 。 機能または特定のバージョンが存在するかどうかを判断するには、 メソッドを IsPresent 呼び出し、このクラスで提供されている機能識別子を使用して検索する機能を指定します。
OSFeature() |
OSFeature クラスの新しいインスタンスを初期化します。 |
Layered |
レイヤード トップレベル ウィンドウ機能を表します。 このフィールドは読み取り専用です。 |
Themes |
オペレーティング システムのテーマ機能を表します。 このフィールドは読み取り専用です。 |
Equals(Object) |
指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
Get |
既定のハッシュ関数として機能します。 (継承元 Object) |
Get |
現在のインスタンスの Type を取得します。 (継承元 Object) |
Get |
システムで現在使用できる、指定した機能のバージョンを取得します。 |
Is |
指定した機能の任意のバージョンがシステムにインストールされているかどうかを判断します。 (継承元 FeatureSupport) |
Is |
指定した機能の指定したバージョン、またはそれよりも新しいバージョンがシステムにインストールされているかどうかを判断します。 (継承元 FeatureSupport) |
Is |
オペレーティング システムが、指定した機能またはメトリックをサポートしているかどうかを示す値を取得します。 |
Memberwise |
現在の Object の簡易コピーを作成します。 (継承元 Object) |
To |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
製品 | バージョン |
---|---|
.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 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。