WindowPattern.WindowPatternInformation.IsTopmost 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
AutomationElement가 z-순서에서 맨 위에 있는 요소인지 여부를 지정하는 값을 가져옵니다.
public:
property bool IsTopmost { bool get(); };
public bool IsTopmost { get; }
member this.IsTopmost : bool
Public ReadOnly Property IsTopmost As Boolean
속성 값
AutomationElement가 맨 위에 있으면 true
이고, 그렇지 않으면 false
입니다.
예제
다음 예제에서는 AutomationPropertyChangedEventHandler 에 변경 내용을 수신 대기 하도록 정의 된 합니다 IsTopmostProperty 의 AutomationElement.
///--------------------------------------------------------------------
/// <summary>
/// Register for automation property change events of interest.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
///--------------------------------------------------------------------
private void RegisterForPropertyChangedEvents(
AutomationElement targetControl)
{
AutomationPropertyChangedEventHandler propertyChangeListener =
new AutomationPropertyChangedEventHandler(
OnTopmostPropertyChange);
Automation.AddAutomationPropertyChangedEventHandler(
targetControl,
TreeScope.Element,
propertyChangeListener,
WindowPattern.IsTopmostProperty);
}
'''--------------------------------------------------------------------
''' <summary>
''' Register for automation property change events of interest.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
'''--------------------------------------------------------------------
Private Sub RegisterForPropertyChangedEvents( _
ByVal targetControl As AutomationElement)
Dim propertyChangeListener As AutomationPropertyChangedEventHandler = _
New AutomationPropertyChangedEventHandler(AddressOf _
OnTopmostPropertyChange)
Automation.AddAutomationPropertyChangedEventHandler( _
targetControl, _
TreeScope.Element, _
propertyChangeListener, _
WindowPattern.IsTopmostProperty)
End Sub
///--------------------------------------------------------------------
/// <summary>
/// Register for automation property change events of interest.
/// </summary>
/// <param name="src">Object that raised the event.</param>
/// <param name="e">Event arguments.</param>
///--------------------------------------------------------------------
private void OnTopmostPropertyChange(object src, AutomationPropertyChangedEventArgs e)
{
// Make sure the element still exists. Elements such as tooltips
// can disappear before the event is processed.
AutomationElement sourceElement;
try
{
sourceElement = src as AutomationElement;
}
catch (ElementNotAvailableException)
{
return;
}
// Get a WindowPattern from the source of the event.
WindowPattern windowPattern = GetWindowPattern(sourceElement);
if (windowPattern.Current.IsTopmost)
{
//TODO: event handling
}
}
'''--------------------------------------------------------------------
''' <summary>
''' Register for automation property change events of interest.
''' </summary>
''' <param name="src">Object that raised the event.</param>
''' <param name="e">Event arguments.</param>
'''--------------------------------------------------------------------
Private Sub OnTopmostPropertyChange(ByVal src As Object, _
ByVal e As AutomationPropertyChangedEventArgs)
' Make sure the element still exists. Elements such as tooltips
' can disappear before the event is processed.
Dim sourceElement As AutomationElement
Try
sourceElement = DirectCast(src, AutomationElement)
Catch exc As ElementNotAvailableException
Return
End Try
' Get a WindowPattern from the source of the event.
Dim windowPattern As WindowPattern = GetWindowPattern(sourceElement)
If (WindowPattern.Current.IsTopmost) Then
'TODO: event handling
End If
End Sub
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET