FeatureSupport Třída

Definice

Poskytuje static metody pro načítání informací o funkcích z aktuálního systému.

public ref class FeatureSupport abstract : System::Windows::Forms::IFeatureSupport
public abstract class FeatureSupport : System.Windows.Forms.IFeatureSupport
type FeatureSupport = class
    interface IFeatureSupport
Public MustInherit Class FeatureSupport
Implements IFeatureSupport
Dědičnost
FeatureSupport
Odvozené
Implementuje

Příklady

Následující příklad používá implementaci OSFeatureFeatureSupport funkce a dotazy LayeredWindows . Verze je kontrolována, aby se zjistilo, zda je null, aby bylo možné určit, zda je funkce přítomna. Výsledek 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 Metody této třídy použijte, když třídy dotazování na informace o funkcích implementují IFeatureSupport rozhraní. Jinak dědí z FeatureSupport vlastní implementace a poskytne vám vlastní implementaci. Implementace této třídy naleznete v tématu OSFeature.

Pokud chcete získat číslo verze funkce, zavolejte GetVersionPresent. Voláním IsPresent určíte, jestli je nainstalovaná určitá funkce nebo verze funkce.

Poznámky pro implementátory

Při dědění z FeatureSupport, musíte přepsat metodu GetVersionPresent(String, String) . Při přepsání této metody zkontrolujte, zda třída, kterou používáte pro feature parametr, je stejná jako třída použitá pro tento parametr v IsPresent(String, String) metodě. Pokud se tyto dva feature parametry liší, musíte také přepsat IsPresent(String, String).

Konstruktory

Name Description
FeatureSupport()

Inicializuje novou instanci FeatureSupport třídy.

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)

Při přepsání v odvozené třídě získá verzi zadané funkce, která je k dispozici v systému.

GetVersionPresent(String, String)

Získá verzi zadané funkce, která je k dispozici v systému.

IsPresent(Object, Version)

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

IsPresent(Object)

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

IsPresent(String, String, Version)

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

IsPresent(String, String)

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

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é