[英]C# Coverting 1px mouse movement to different resolution
I've built custom control pad instead of mouse and written application to pick up movments but possible coordinates are in range of max width: 320px and max height: 240px, since i would like to control my mouse with control pad I need a way to convert coords from res 320x240 to different screen resoultions ie 1280x720 so when my control pad pointer is at coords of 160x120 my mouse would be at middle of screen. 我已经建立了自定义控制板,而不是鼠标和书面应用程序来拾取运动,但是可能的坐标在最大宽度:320px和最大高度:240px的范围内,因为我想使用控制板来控制鼠标,因此我需要一种将坐标从res 320x240转换为不同的屏幕分辨率,即1280x720,因此当我的控制板指针位于160x120的坐标时,我的鼠标将位于屏幕中间。 Does any one have any solution or code snippet that I can use?
有没有人可以使用的解决方案或代码片段?
Thanks 谢谢
Use floating point and something like this to convert from 0
.. low_res_maximum
to 0
.. high_res_maximum
使用浮点和这样的事情,从转换
0
.. low_res_maximum
到0
.. high_res_maximum
low_res_coordinate * high_res_maximum / low_res_maximum
Eg: 例如:
high_res_x = low_res_x * 1280.0 / 320.0;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.