gpt4 book ai didi

WPF:如何在代码中定位鼠标光标?

转载 作者:行者123 更新时间:2023-12-05 00:26:39 30 4
gpt4 key购买 nike

我正在无边框窗口上实现系统菜单(恢复、 move 、大小...),我希望在选择大小或 move 时鼠标光标 move 到窗口的中心。

最好是在 VB 中,但 C# 也很好。

最佳答案

您可以使用 SetCursorPos 函数,例如:

Declare Function SetCursorPos& Lib "user32" (ByVal p As Point)

'...

dim p as point
p.x = 100
p.y = 200
SetCursorPos p

关于WPF:如何在代码中定位鼠标光标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2269138/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com