OSFeature Třída

Definice

Poskytuje dotazy na funkce specifické pro operační systém.

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
Dědičnost

Příklady

Následující příklad používá OSFeature k dotazování operačního systému, aby zjistil, jestli LayeredWindows je funkce nainstalovaná. Příklad představuje dva různé způsoby kontroly, jestli je funkce k dispozici. V první metodě se zkontroluje, myVersion jestli se jedná nullo . Pokud je nullverze , tato funkce není nainstalována. V druhé metodě volá příklad metodu IsPresent základní třídy, aby se zjistilo, jestli je funkce nainstalovaná. Výsledky se zobrazí v textovém poli.

Tento kód předpokládá, že textBox1 byl vytvořen a umístěn ve formuláři.

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

Poznámky

K dotazování na static funkce operačního systému použijte instanci této třídy uvedenou ve Feature vlastnosti . Nelze vytvořit instanci této třídy.

Pokud chcete zjistit verzi funkce, zavolejte metodu GetVersionPresent . Chcete-li zjistit, zda je k dispozici funkce nebo konkrétní verze, zavolejte metodu IsPresent a určete funkci, která se má vyhledat pomocí identifikátorů funkcí uvedených v této třídě.

Konstruktory

OSFeature()

Inicializuje novou instanci OSFeature třídy.

Pole

LayeredWindows

Představuje vrstvenou funkci oken nejvyšší úrovně. Toto pole je jen ke čtení.

Themes

Představuje funkci motivů operačního systému. Toto pole je jen ke čtení.

Vlastnosti

Feature

static Získá instanci OSFeature třídy, která se má použít pro dotazy na funkce. Tato vlastnost je jen ke čtení.

Metody

Equals(Object)

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

(Zděděno od Object)
GetHashCode()

Slouží jako výchozí hashovací funkce.

(Zděděno od Object)
GetType()

Získá aktuální Type instanci.

(Zděděno od Object)
GetVersionPresent(Object)

Načte verzi zadané funkce, která je aktuálně k dispozici v systému.

IsPresent(Object)

Určuje, zda je v systému nainstalována nějaká verze zadané funkce.

(Zděděno od FeatureSupport)
IsPresent(Object, Version)

Určuje, zda je v systému nainstalována zadaná nebo novější verze zadané funkce.

(Zděděno od FeatureSupport)
IsPresent(SystemParameter)

Načte hodnotu označující, zda operační systém podporuje zadanou funkci nebo metriku.

MemberwiseClone()

Vytvoří mělkou kopii aktuálního Objectsouboru .

(Zděděno od Object)
ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Platí pro

Viz také