OSFeature Klasa

Definicja

Udostępnia zapytania dotyczące funkcji specyficznych dla systemu operacyjnego.

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
Dziedziczenie

Przykłady

W poniższym przykładzie użyto OSFeature metody do wykonywania zapytań dotyczących systemu operacyjnego w celu określenia, czy LayeredWindows funkcja jest zainstalowana. W przykładzie przedstawiono dwa różne sposoby sprawdzania, czy funkcja jest obecna. W pierwszej metodzie jest sprawdzana wartość , aby sprawdzić, myVersion czy jest to null. Jeśli wersja to null, funkcja nie jest zainstalowana. W drugiej metodzie przykład wywołuje metodę IsPresent klasy bazowej, aby sprawdzić, czy funkcja jest zainstalowana. Wyniki są wyświetlane w polu tekstowym.

Ten kod zakłada textBox1 , że został utworzony i umieszczony w formularzu.

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

Uwagi

static Użyj wystąpienia tej klasy udostępnionego Feature we właściwości , aby wykonywać zapytania dotyczące funkcji systemu operacyjnego. Nie można utworzyć wystąpienia tej klasy.

Aby określić wersję funkcji, wywołaj metodę GetVersionPresent . Aby określić, czy funkcja lub określona wersja jest obecna, wywołaj IsPresent metodę i określ funkcję do wyszukania przy użyciu identyfikatorów funkcji podanych w tej klasie.

Konstruktory

OSFeature()

Inicjuje nowe wystąpienie klasy OSFeature.

Pola

LayeredWindows

Reprezentuje funkcję warstwowych okien najwyższego poziomu. To pole jest tylko do odczytu.

Themes

Reprezentuje funkcję motywów systemu operacyjnego. To pole jest tylko do odczytu.

Właściwości

Feature

static Pobiera wystąpienie OSFeature klasy do użycia na potrzeby zapytań funkcji. Ta właściwość jest tylko do odczytu.

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
GetVersionPresent(Object)

Pobiera wersję określonej funkcji obecnie dostępnej w systemie.

IsPresent(Object)

Określa, czy w systemie jest zainstalowana dowolna wersja określonej funkcji.

(Odziedziczone po FeatureSupport)
IsPresent(Object, Version)

Określa, czy określona lub nowsza wersja określonej funkcji jest zainstalowana w systemie.

(Odziedziczone po FeatureSupport)
IsPresent(SystemParameter)

Pobiera wartość wskazującą, czy system operacyjny obsługuje określoną funkcję, czy metrykę.

MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy

Zobacz też