03-28-2024, 05:57 AM
var w = wnd.find(1, "* - Google Chrome", "Chrome_WidgetWin_1");
w.MoveVisibleArea(0, 0, 1386, 560);
print.it(w.Rect);
if (w.GetRect(out var r, withoutExtendedFrame: true)) print.it(r);
static class MyExtWnd {
/// <summary>
/// Moves this window as if its rectangle does not include the transparent frame.
/// </summary>
/// <exception cref="AuWndException">Invalid window.</exception>
public static void MoveVisibleArea(this wnd t, RECT r) {
if (!t.GetRect(out var rTrue) || !t.GetRect(out var rVisible, withoutExtendedFrame: true)) throw new AuWndException(t);
if (rVisible != rTrue) {
r.left -= rVisible.left - rTrue.left;
r.right += rTrue.right - rVisible.right;
r.bottom += rTrue.bottom - rVisible.bottom;
}
t.MoveL(r);
}
/// <inheritdoc cref="MoveVisibleArea(wnd, RECT)"/>
public static void MoveVisibleArea(this wnd t, int left, int top, int width, int height)
=> MoveVisibleArea(t, new(left, top, width, height));
}