Sdílet prostřednictvím


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 k určení, zda LayeredWindows je funkce nainstalována. Tento příklad představuje dva různé způsoby kontroly, jak zjistit, jestli je funkce k dispozici. V první metodě je zaškrtnuto, myVersion zda je null. Pokud je nullverze, funkce není nainstalovaná. Ve druhé metodě příklad volá metodu IsPresent základní třídy, aby se zjistilo, jestli je funkce nainstalována. Výsledky se zobrazí v textovém poli.

Tento kód předpokládá textBox1 , že 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

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

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

Konstruktory

Name Description
OSFeature()

Inicializuje novou instanci OSFeature třídy.

Pole

Name Description
LayeredWindows

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

Themes

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

Vlastnosti

Name Description
Feature

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

Metody

Name Description
Equals(Object)

Určuje, zda je zadaný objekt roven aktuálnímu objektu.

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

Slouží jako výchozí funkce hash.

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

Získá Type aktuální instance.

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

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

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(Object)

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

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

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

MemberwiseClone()

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

(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é