Share via


OSFeature Kelas

Definisi

Menyediakan kueri fitur khusus sistem operasi.

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
Warisan

Contoh

Contoh berikut menggunakan OSFeature untuk mengkueri sistem operasi untuk menentukan apakah LayeredWindows fitur diinstal. Contohnya menyajikan dua cara pemeriksaan yang berbeda untuk melihat apakah fitur tersebut ada. Dalam metode pertama, myVersion diperiksa untuk melihat apakah itu null. Jika versinya , nullfitur tidak diinstal. Dalam metode kedua, contoh memanggil metode IsPresent kelas dasar untuk melihat apakah fitur diinstal. 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 instans kelas ini yang disediakan di Feature properti untuk mengkueri fitur sistem operasi. Anda tidak dapat membuat instans kelas ini.

Untuk menentukan versi fitur, panggil GetVersionPresent metode . Untuk menentukan apakah fitur atau versi tertentu ada, panggil IsPresent metode dan tentukan fitur yang akan dicari dengan pengidentifikasi fitur yang disediakan di kelas ini.

Konstruktor

OSFeature()

Menginisialisasi instans baru kelas OSFeature.

Bidang

LayeredWindows

Mewakili fitur jendela tingkat atas yang berlapis. Bidang ini hanya-baca.

Themes

Mewakili fitur tema sistem operasi. Bidang ini hanya-baca.

Properti

Feature

Mendapatkan instans static kelas yang OSFeature akan digunakan untuk kueri fitur. Properti ini bersifat hanya baca.

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)

Mengambil versi fitur yang ditentukan yang saat ini tersedia pada sistem.

IsPresent(Object)

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

(Diperoleh dari FeatureSupport)
IsPresent(Object, Version)

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

(Diperoleh dari FeatureSupport)
IsPresent(SystemParameter)

Mengambil nilai yang menunjukkan apakah sistem operasi mendukung fitur atau metrik yang ditentukan.

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