开发者

point to resolution conversion

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.


  • 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.


You can write ScreenWidth * x - Window.Left

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜