FeatureSupport クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
現在のシステムから機能情報を取得するための static メソッドを提供します。
public ref class FeatureSupport abstract : System::Windows::Forms::IFeatureSupport
public abstract class FeatureSupport : System.Windows.Forms.IFeatureSupport
type FeatureSupport = class
interface IFeatureSupport
Public MustInherit Class FeatureSupport
Implements IFeatureSupport
- 継承
-
FeatureSupport
- 派生
- 実装
例
次の例では、OSFeature機能のFeatureSupportとクエリのLayeredWindows実装を使用します。 バージョンは、機能が存在するかどうかを判断するために、 nullされているかどうかを確認するためにチェックされます。 結果がテキスト ボックスに表示されます。 このコードは、 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 メソッドは、フィーチャ情報のクエリを実行するクラスが IFeatureSupport インターフェイスを実装する場合に使用します。 それ以外の場合は、 FeatureSupport から継承し、独自の実装を提供します。 このクラスの実装については、 OSFeatureを参照してください。
機能のバージョン番号を取得するには、 GetVersionPresentを呼び出します。 IsPresentを呼び出して、機能の特定の機能またはバージョンがインストールされているかどうかを判断します。
注意 (実装者)
FeatureSupportから継承する場合は、GetVersionPresent(String, String) メソッドをオーバーライドする必要があります。 このメソッドをオーバーライドする場合は、 feature パラメーターに使用するクラスが、 IsPresent(String, String) メソッドでこのパラメーターに使用されるクラスと同じであることを確認します。 2 つの feature パラメーターが異なる場合は、 IsPresent(String, String)もオーバーライドする必要があります。
コンストラクター
| 名前 | 説明 |
|---|---|
| FeatureSupport() |
FeatureSupport クラスの新しいインスタンスを初期化します。 |
メソッド
| 名前 | 説明 |
|---|---|
| Equals(Object) |
指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| GetVersionPresent(Object) |
派生クラスでオーバーライドされると、システムで使用できる指定された機能のバージョンを取得します。 |
| GetVersionPresent(String, String) |
システムで使用できる指定された機能のバージョンを取得します。 |
| IsPresent(Object, Version) |
指定した機能の指定したバージョンまたは新しいバージョンがシステムにインストールされているかどうかを判断します。 |
| IsPresent(Object) |
指定した機能のバージョンがシステムにインストールされているかどうかを判断します。 |
| IsPresent(String, String, Version) |
指定した機能の指定したバージョンまたは新しいバージョンがシステムにインストールされているかどうかを判断します。 このメソッドは |
| IsPresent(String, String) |
指定した機能のバージョンがシステムにインストールされているかどうかを判断します。 このメソッドは |
| MemberwiseClone() |
現在の Objectの簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |