OSFeature Classe

Definição

Fornece consultas de funcionalidades específicas do sistema operativo.

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
Herança

Exemplos

O exemplo seguinte serve OSFeature para consultar o sistema operativo e determinar se a LayeredWindows funcionalidade está instalada. O exemplo apresenta duas formas diferentes de verificar se a característica está presente. No primeiro método, myVersion verifica-se se é null. Se a versão for null, a funcionalidade não está instalada. No segundo método, o exemplo chama o método IsPresent da classe base para verificar se a funcionalidade está instalada. Os resultados são apresentados numa caixa de texto.

Este código assume textBox1 que foi criado e colocado num formulário.

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

Observações

Use a static instância desta classe fornecida na Feature propriedade para consultar funcionalidades do sistema operativo. Não podes criar uma instância desta classe.

Para determinar a versão de uma funcionalidade, chame o GetVersionPresent método. Para determinar se existe uma característica ou uma versão específica, chame o IsPresent método e especifique a característica a procurar com os identificadores de características fornecidos nesta classe.

Construtores

Name Description
OSFeature()

Inicializa uma nova instância da OSFeature classe.

Campos

Name Description
LayeredWindows

Representa a funcionalidade de janelas em camadas, de nível superior. Este campo é só de leitura.

Themes

Representa a funcionalidade de temas do sistema operativo. Este campo é só de leitura.

Propriedades

Name Description
Feature

Obtém uma static instância da OSFeature classe para usar em consultas de características. Esta propriedade é somente leitura.

Métodos

Name Description
Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.

(Herdado de Object)
GetHashCode()

Serve como função de hash predefinida.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
GetVersionPresent(Object)

Recupera a versão da funcionalidade especificada atualmente disponível no sistema.

IsPresent(Object, Version)

Determina se a versão especificada ou mais recente da funcionalidade especificada está instalada no sistema.

(Herdado de FeatureSupport)
IsPresent(Object)

Determina se alguma versão da funcionalidade especificada está instalada no sistema.

(Herdado de FeatureSupport)
IsPresent(SystemParameter)

Recupera um valor que indica se o sistema operativo suporta a funcionalidade ou métrica especificada.

MemberwiseClone()

Cria uma cópia superficial do atual Object.

(Herdado de Object)
ToString()

Devolve uma cadeia que representa o objeto atual.

(Herdado de Object)

Aplica-se a

Ver também