Share via


FeatureSupport Kelas

Definisi

Menyediakan static metode untuk mengambil informasi fitur dari sistem saat ini.

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
Warisan
FeatureSupport
Turunan
Penerapan

Contoh

Contoh berikut menggunakan OSFeature implementasi FeatureSupport dan kueri untuk fitur tersebut LayeredWindows . Versi diperiksa untuk melihat apakah itu null, untuk menentukan apakah fitur tersebut ada. Hasilnya ditampilkan dalam kotak teks. Kode ini mengasumsikan textBox1 telah dibuat dan ditempatkan pada formulir.

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

Keterangan

static Gunakan metode kelas ini saat kelas yang Anda kueri untuk informasi fitur mengimplementasikan IFeatureSupport antarmuka. Jika tidak, warisi dari FeatureSupport dan berikan implementasi Anda sendiri. Untuk implementasi kelas ini, lihat OSFeature.

Untuk mendapatkan nomor versi fitur, panggil GetVersionPresent. Panggil IsPresent untuk menentukan apakah fitur atau versi fitur tertentu diinstal.

Catatan Bagi Implementer

Ketika Anda mewarisi dari FeatureSupport, Anda harus mengambil GetVersionPresent(String, String) alih metode . Saat Anda mengambil alih metode ini, periksa apakah kelas yang Anda gunakan untuk feature parameter sama dengan kelas yang digunakan untuk parameter ini dalam IsPresent(String, String) metode . Jika dua feature parameter berbeda, Anda juga harus mengambil IsPresent(String, String)alih .

Konstruktor

FeatureSupport()

Menginisialisasi instans baru kelas FeatureSupport.

Metode

Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()

Mendapatkan dari instans Type saat ini.

(Diperoleh dari Object)
GetVersionPresent(Object)

Saat ditimpa di kelas turunan, mendapatkan versi fitur yang ditentukan yang tersedia pada sistem.

GetVersionPresent(String, String)

Mendapatkan versi fitur yang ditentukan yang tersedia di sistem.

IsPresent(Object)

Menentukan apakah ada versi fitur yang ditentukan yang diinstal dalam sistem.

IsPresent(Object, Version)

Menentukan apakah versi yang ditentukan atau yang lebih baru dari fitur yang ditentukan diinstal dalam sistem.

IsPresent(String, String)

Menentukan apakah ada versi fitur yang ditentukan yang diinstal dalam sistem. Metode ini adalah static.

IsPresent(String, String, Version)

Menentukan apakah versi yang ditentukan atau yang lebih baru dari fitur yang ditentukan diinstal dalam sistem. Metode ini adalah static.

MemberwiseClone()

Membuat salinan dangkal dari saat ini Object.

(Diperoleh dari Object)
ToString()

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Berlaku untuk

Lihat juga