次のコードを使用して、サード パーティの .net アプリケーションでスクロールバーをスクロールしようとしています。Visual Studio でコードを実行すると、アクセス違反がスローされます。Visual Studio の外でアセンブリを実行すると、サポートされていないパターンと表示されます。どんなアイデアでも大歓迎です =]
if(child.Current.ClassName == "ScrollBar")
{
PropertyCondition condition = new PropertyCondition(AutomationElement.AutomationIdProperty, child.Current.AutomationId);
AutomationElement btnElement = child.FindFirst(TreeScope.Element, condition);
ScrollPattern btnPattern = btnElement.GetCurrentPattern(ScrollPattern.Pattern) as ScrollPattern;
btnPattern.ScrollVertical(ScrollAmount.LargeIncrement);
}