Skip to content

Commit 2c0c65b

Browse files
authored
Merge pull request #319 from ynerant/patch-1
Fix control bitmap bounds with DWM enabled
2 parents b261aec + c36acb8 commit 2c0c65b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

uiautomation/uiautomation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3517,6 +3517,10 @@ def FromControl(control: 'Control', x: int = 0, y: int = 0, width: int = 0, heig
35173517
handle = control.NativeWindowHandle
35183518
if handle:
35193519
pRect = control.BoundingRectangle
3520+
toplevelHandle = GetAncestor(handle, GAFlag.Root)
3521+
if toplevelHandle and toplevelHandle == handle:
3522+
if DwmIsCompositionEnabled():
3523+
pRect = DwmGetWindowExtendFrameBounds(handle) or pRect
35203524
left = rect.left - pRect.left + x
35213525
top = rect.top - pRect.top + y
35223526
right = left + width

0 commit comments

Comments
 (0)