共用方式為


OSFeature.Feature 屬性

定義

取得 OSFeature 類別的 static 執行個體,以便用於功能查詢。 這個屬性是唯讀的。

public:
 static property System::Windows::Forms::OSFeature ^ Feature { System::Windows::Forms::OSFeature ^ get(); };
public static System.Windows.Forms.OSFeature Feature { get; }
static member Feature : System.Windows.Forms.OSFeature
Public Shared ReadOnly Property Feature As OSFeature

屬性值

OSFeature 類別的執行個體。

範例

下列範例會 LayeredWindows 查詢 OSFeature 功能。 檢查版本是否為 null ,以判斷功能是否存在。 結果會顯示在文字方塊中。 此程式碼假設 textBox1 已建立並置於表單上。

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";
      }
   }
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";
}
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
End Sub

備註

使用這個 static 屬性來查詢作業系統功能。 您無法建立這個類別的實例。

若要判斷功能的版本,請呼叫 GetVersionPresent 方法。 若要判斷功能或特定版本是否存在,請呼叫 IsPresent 方法,並指定功能來尋找此類別中提供的功能識別碼。

適用於

另請參閱