如何设置允许光标移动的区域/矩形? [英] How to set the area/rectangle in which the cursor is allowed to move?

查看:24
本文介绍了如何设置允许光标移动的区域/矩形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如当你点击显示器的一侧时,你的光标不能再移动了,更多的例子是在微软油漆中,当你从 RGB 表中选择一种颜色时,它不会让你的鼠标离开鼠标按下时的矩形..

E.g. when you hit the side of your monitor your cursor can't go any further, and more of an example is when in microsoft paint, and your choosing a colour from the RGB table, it won't allow your mouse to go outside of the rectangle while your mouse is down..

我的问题是,您将如何使用 win32 api 在 C++ 中实现它?

my question is how would you implement that in c++ with win32 api?

推荐答案

您可以使用 Microsoft 提供的以下功能

You can use the following function from Microsoft

BOOL WINAPI ClipCursor(
  __in_opt  const RECT *lpRect
); 

请参阅 http://msdn.microsoft.com/en-us/library/ms648383(VS.85).aspx

这篇关于如何设置允许光标移动的区域/矩形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆