点到分辨率转换

发布于 2024-11-19 19:46:40 字数 289 浏览 1 评论 0原文

我正在使用凝视检测硬件,但遇到一些数字问题。首先,坐标从 (0,0) [屏幕左上角] 到 (1,1) [屏幕右下角]。当我凝视屏幕左上角时,系统会拾取 (0.35,0.30) 当我凝视屏幕右下角时,系统会拾取 (0.65, 0.80) 它拾取这些值而不是 (0,0) 的原因(1,1) 是因为屏幕分辨率为 1600x900,但我的应用程序仅占据屏幕的一部分 (817x500)。我的问题是,鉴于我的应用程序窗口是 (817x500),如何将 (0.35,0.30) 这样的实际数字转换为屏幕上的某个位置,例如 (400,200)?

我用的是VB6。

I am using gaze detection hardware and i am having some numeric issues. First off the co-ordinates work from (0,0) [top left of the screen] to (1,1) [bottom right of the screen]. When i gaze to the top left of the screen the system picks up (0.35,0.30) when I gaze to the bottom right the system picks up (0.65, 0.80) The reason it is picking up these values instead of (0,0) and (1,1) is because the screen resolution is 1600x900 but my application only occupies a portion of the screen at (817x500). My question is, how can i convert actual numbers like (0.35,0.30) to a location on the screen such as (400,200) given that my application windows is (817x500)??

I am using VB6.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陈甜 2024-11-26 19:46:41
  • Screen.WidthScreen.Height 返回整个屏幕的宽度和高度。
  • 表单 宽度Height 属性返回表单 frm 的宽度和高度。这些是外部尺寸,包括边框和标题栏。

尝试将类似的内容添加到您的表单代码(空中代码)中

Sub GazeToForm( ByVal gazeX As Double, ByVal gazeY As Double, _
  ByRef frmX As Double, ByRef frmY As Double) 

  frmX = (gazeX * Screen.Width) - Me.Left 
  frmY = (gazeY * Screen.Height) - Me.Top 

End Sub

所有这些坐标和尺寸均以为单位,如通常在 VB6 中一样。

  • Screen.Width and Screen.Height return the width and height of the entire screen.
  • The form Width and Height properties return the width and height of your form frm. These are the external dimensions, including the borders and title bar.

Try adding something like this to your form code (air code)

Sub GazeToForm( ByVal gazeX As Double, ByVal gazeY As Double, _
  ByRef frmX As Double, ByRef frmY As Double) 

  frmX = (gazeX * Screen.Width) - Me.Left 
  frmY = (gazeY * Screen.Height) - Me.Top 

End Sub

All these coordinates and dimensions are in twips, as usual in VB6.

浅紫色的梦幻 2024-11-26 19:46:41

您可以编写ScreenWidth * x - Window.Left

You can write ScreenWidth * x - Window.Left

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文