OSFeature Classe

Definição

Fornece consultas de recurso específico do sistema operacional.

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 a seguir usa OSFeature para consultar o sistema operacional para determinar se o LayeredWindows recurso está instalado. O exemplo apresenta duas maneiras diferentes de verificar se o recurso está presente. No primeiro método, myVersion é verificado para ver se ele é null. Se a versão for null, o recurso não será instalado. No segundo método, o exemplo chama o método IsPresent de classe base para ver se o recurso está instalado. Os resultados são exibidos em uma caixa de texto.

Esse código pressupõe textBox1 que foi criado e colocado em um 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

Comentários

Use a static instância dessa classe fornecida na Feature propriedade para consultar recursos do sistema operacional. Não é possível criar uma instância dessa classe.

Para determinar a versão de um recurso, chame o GetVersionPresent método . Para determinar se um recurso ou uma versão específica está presente, chame o IsPresent método e especifique o recurso a ser buscado com os identificadores de recurso fornecidos nessa classe.

Construtores

OSFeature()

Inicializa uma nova instância da classe OSFeature.

Campos

LayeredWindows

Representa o recurso do Windows em camadas de nível superior. Este campo é somente leitura.

Themes

Representa o recurso de temas do sistema operacional. Este campo é somente leitura.

Propriedades

Feature

Obtém uma instância static da classe OSFeature a ser usada para consultas de recurso. Esta propriedade é somente para leitura.

Métodos

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
GetVersionPresent(Object)

Recupera a versão do recurso especificado que está disponível no sistema no momento.

IsPresent(Object)

Determina se alguma versão do recurso especificado está instalada no sistema.

(Herdado de FeatureSupport)
IsPresent(Object, Version)

Determina se a versão especificada ou mais recente do recurso indicado está instalada no sistema.

(Herdado de FeatureSupport)
IsPresent(SystemParameter)

Recupera um valor que indica se o sistema operacional é compatível com recursos ou métricas especificados.

MemberwiseClone()

Cria uma cópia superficial do Object atual.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.

(Herdado de Object)

Aplica-se a

Confira também