Bagikan melalui


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 untuk mengkueri OSFeature 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 adalah null, fitur tidak diinstal. Pada 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 dalam 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

Nama Deskripsi
OSFeature()

Menginisialisasi instans baru dari kelas OSFeature.

Bidang

Nama Deskripsi
LayeredWindows

Mewakili fitur jendela tingkat atas berlapis. Bidang ini hanya dapat dibaca.

Themes

Mewakili fitur tema sistem operasi. Bidang ini hanya dapat dibaca.

Properti

Nama Deskripsi
Feature

Mendapatkan instans static kelas yang OSFeature akan digunakan untuk kueri fitur. Properti ini hanya dapat dibaca.

Metode

Nama Deskripsi
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 Type instans saat ini.

(Diperoleh dari Object)
GetVersionPresent(Object)

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

IsPresent(Object, Version)

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

(Diperoleh dari FeatureSupport)
IsPresent(Object)

Menentukan apakah ada versi fitur yang ditentukan yang 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 Objectsaat ini.

(Diperoleh dari Object)
ToString()

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Berlaku untuk

Lihat juga