システムで使用できる指定した機能のバージョンを取得します。
オーバーロードの一覧
派生クラスによってオーバーライドされるときに、このシステムで使用できる、指定した機能のバージョンを取得します。
[Visual Basic] Overloads Public MustOverride Function GetVersionPresent(Object) As Version Implements IFeatureSupport.GetVersionPresent
[C++] public: virtual Version* GetVersionPresent(Object*) = 0;
[JScript] public abstract function GetVersionPresent(Object) : Version;
システムで使用できる指定した機能のバージョンを取得します。
[Visual Basic] Overloads Public Shared Function GetVersionPresent(String, String) As Version
[C#] public static Version GetVersionPresent(string, string);
[C++] public: static Version* GetVersionPresent(String*, String*);
[JScript] public static function GetVersionPresent(String, String) : Version;
使用例
[Visual Basic, C#, C++] FeatureSupport の OSFeature 実装を使用し、 LayeredWindows 機能の有無を問い合わせる例を次に示します。機能が存在するかどうかを確認するには、バージョンが null 参照 (Visual Basic では Nothing) かどうかを調べます。結果はテキスト ボックスに表示されます。このコードは、 textBox1
が作成され、フォーム上に配置されていることを前提にしています。
[Visual Basic, C#, C++] メモ ここでは、GetVersionPresent のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。
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 Not (myVersion Is 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
[C#]
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.";
}
[C++]
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 != 0)
textBox1->Text = S"Layered windows feature is installed.\n";
else
textBox1->Text = S"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, S"Again, layered windows feature is installed." );
else
textBox1->Text = String::Concat( textBox1->Text, S"Again, layered windows feature is not installed." );
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
参照
FeatureSupport クラス | FeatureSupport メンバ | System.Windows.Forms 名前空間