Este tema aún no ha recibido ninguna valoración - Valorar este tema

IFeatureSupport (Interfaz)

Actualización: noviembre 2007

Especifica una interfaz estándar para obtener información de características del sistema actual.

Espacio de nombres:  System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)
public interface IFeatureSupport
public interface IFeatureSupport
public interface IFeatureSupport

Cuando se implementa en una clase, IFeatureSupport proporciona métodos que se pueden utilizar para determinar si una característica está instalada en el sistema y obtener el número de versión de una característica. Se llama a IsPresent para determinar si una característica o una versión específica de una característica está actualmente instalada. Se llama a GetVersionPresent para determinar el número de versión de una característica instalada.

Vea las clases FeatureSupport y OSFeature para obtener información sobre la implementación de esta interfaz.

El ejemplo siguiente utiliza la implementación OSFeature de IFeatureSupport y hace una consulta para obtener la función LayeredWindows. La versión se comprueba para ver si es null con el fin de determinar si la característica está presente. El resultado se muestra en un cuadro de texto. Este código supone que se ha creado textBox1 y se ha colocado en un formulario.

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 void LayeredWindows()
{
    // Gets the version of the layered windows feature.
    Version myVersion = OSFeature.get_Feature().GetVersionPresent
        (OSFeature.LayeredWindows);

    // Prints whether the feature is available.
    if (myVersion != null) {
        textBox1.set_Text("Layered windows feature is installed." 
            + '\n');
    }
    else {
        textBox1.set_Text("Layered windows feature is not installed." 
            + '\n');
    }

    // This is an alternate way to check whether a feature is present.
    if (OSFeature.get_Feature().IsPresent(OSFeature.LayeredWindows)) {
        textBox1.set_Text(textBox1.get_Text()
            + "Again, layered windows feature is installed.");
    }
    else {
        textBox1.set_Text(textBox1.get_Text() 
            + "Again, layered windows feature is not installed.");
    }
} //LayeredWindows 


Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

.NET Framework

Compatible con: 3.5, 3.0, 2.0, 1.1, 1.0
¿Le ha resultado útil?
(Caracteres restantes: 1500)
Contenido de la comunidad Agregar