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

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

问题描述

例如。当你打你的显示器侧面光标不能再往前走,多的一个例子是微软油漆的时候,你的选择从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..

我的问题是你会怎么实现,在C ++与Win32 API的?

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天全站免登陆