簡體   English   中英

如何在WPF中設置鼠標位置

[英]How to set mouse position in WPF

實際上, http ://social.expression.microsoft.com/Forums/es-ES/wpf/thread/6be8299a-9616-43f4-a72f-799da1193889中描述了一種方法

[System.Runtime.InteropServices.DllImportAttribute("user32.dll", EntryPoint = "SetCursorPos")]   
[return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)]   
public static extern bool SetCursorPos(int X, int Y);   

我想在自定義控件中為光標定義一個可移動區域。 使用此本機函數會使光標閃爍。

還有另一種方法可以設置不會引起閃爍的鼠標位置嗎?

也許您可以從不受管理的ClipCursor函數中受益。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM