OSFeature Classe
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Fornisce query di funzionalità specifiche del 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
- Ereditarietà
Esempio
Nell'esempio seguente viene OSFeature usato per eseguire una query sul sistema operativo per determinare se la LayeredWindows funzionalità è installata. L'esempio presenta due modi diversi per verificare se la funzionalità è presente. Nel primo metodo viene myVersion verificato se è null. Se la versione è null, la funzionalità non è installata. Nel secondo metodo l'esempio chiama il metodo IsPresent della classe base per verificare se la funzionalità è installata. I risultati vengono visualizzati in una casella di testo.
Questo codice presuppone textBox1 che sia stato creato e inserito in un modulo.
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
Commenti
Usare l'istanza static di questa classe fornita nella Feature proprietà per eseguire una query per individuare le funzionalità del sistema operativo. Non è possibile creare un'istanza di questa classe.
Per determinare la versione di una funzionalità, chiamare il GetVersionPresent metodo . Per determinare se è presente una funzionalità o una versione specifica, chiamare il IsPresent metodo e specificare la funzionalità da cercare con gli identificatori di funzionalità forniti in questa classe.
Costruttori
| Nome | Descrizione |
|---|---|
| OSFeature() |
Inizializza una nuova istanza della classe OSFeature. |
Campi
| Nome | Descrizione |
|---|---|
| LayeredWindows |
Rappresenta la funzionalità delle finestre di primo livello a più livelli. Il campo è di sola lettura. |
| Themes |
Rappresenta la funzionalità temi del sistema operativo. Il campo è di sola lettura. |
Proprietà
| Nome | Descrizione |
|---|---|
| Feature |
Ottiene un'istanza |
Metodi
| Nome | Descrizione |
|---|---|
| Equals(Object) |
Determina se l'oggetto specificato è uguale all'oggetto corrente. (Ereditato da Object) |
| GetHashCode() |
Funge da funzione hash predefinita. (Ereditato da Object) |
| GetType() |
Ottiene il Type dell'istanza corrente. (Ereditato da Object) |
| GetVersionPresent(Object) |
Recupera la versione della funzionalità specificata attualmente disponibile nel sistema. |
| IsPresent(Object, Version) |
Determina se la versione specificata o successiva della funzionalità specificata è installata nel sistema. (Ereditato da FeatureSupport) |
| IsPresent(Object) |
Determina se nel sistema è installata una versione della funzionalità specificata. (Ereditato da FeatureSupport) |
| IsPresent(SystemParameter) |
Recupera un valore che indica se il sistema operativo supporta la funzionalità o la metrica specificata. |
| MemberwiseClone() |
Crea una copia superficiale del Objectcorrente. (Ereditato da Object) |
| ToString() |
Restituisce una stringa che rappresenta l'oggetto corrente. (Ereditato da Object) |