FeatureSupport クラス

定義

現在のシステムから機能情報を取得するための 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) 必要があります。 このメソッドをオーバーライドする場合、パラメーターに使用するクラスが メソッドでIsPresent(String, String)このパラメーターに使用featureされるクラスと同じであることをチェックします。 2 つの feature パラメーターが異なる場合は、 もオーバーライド IsPresent(String, String)する必要があります。

コンストラクター

FeatureSupport()

FeatureSupport クラスの新しいインスタンスを初期化します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
GetVersionPresent(Object)

派生クラスによってオーバーライドされるときに、このシステムで使用できる、指定した機能のバージョンを取得します。

GetVersionPresent(String, String)

システムで使用できる指定した機能のバージョンを取得します。

IsPresent(Object)

指定した機能の任意のバージョンがシステムにインストールされているかどうかを判断します。

IsPresent(Object, Version)

指定した機能の指定したバージョン、またはそれよりも新しいバージョンがシステムにインストールされているかどうかを判断します。

IsPresent(String, String)

指定した機能の任意のバージョンがシステムにインストールされているかどうかを判断します。 このメソッドは static です。

IsPresent(String, String, Version)

指定した機能の指定したバージョン、またはそれよりも新しいバージョンがシステムにインストールされているかどうかを判断します。 このメソッドは static です。

MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください