共用方式為


IRawElementProviderSimple.GetPatternProvider(Int32) 方法

定義

擷取 物件,該物件支援消費者介面自動化專案上的控制項模式。

public:
 System::Object ^ GetPatternProvider(int patternId);
public object GetPatternProvider (int patternId);
abstract member GetPatternProvider : int -> obj
Public Function GetPatternProvider (patternId As Integer) As Object

參數

patternId
Int32

模式的識別項。

傳回

Object

實作模式介面的物件;如果不支援此模式,則為 null

範例

下列範例顯示僅 InvokePattern 支援 之提供者的 GetPatternProvider 實作。

/// <summary>
/// Returns the object that supports the specified pattern.
/// </summary>
/// <param name="patternId">ID of the pattern.</param>
/// <returns>Object that implements IInvokeProvider.</returns>
object IRawElementProviderSimple.GetPatternProvider(int patternId)
{
    if (patternId == InvokePatternIdentifiers.Pattern.Id)
    {
        // Return an object that implements IInvokeProvider.
        return myInvokePatternProvider;
    }
    else
    {
        return null;
    }
}
''' <summary>
''' Returns the object that supports the specified pattern.
''' </summary>
''' <param name="patternId">ID of the pattern.</param>
''' <returns>Object that implements IInvokeProvider.</returns>
Function GetPatternProvider(ByVal patternId As Integer) As Object _
    Implements IRawElementProviderSimple.GetPatternProvider
    If patternId = InvokePatternIdentifiers.Pattern.Id Then
        ' Return an object that implements IInvokeProvider.
        Return myInvokePatternProvider
    Else
        Return Nothing
    End If

End Function 'IRawElementProviderSimple.GetPatternProvider

適用於

另請參閱