Home > Language Reference > Classes > UIComponent
ScreenToComponent Method
Converts coordinates relative to the screen into coordinates relative a component.
Syntax
Public Sub ScreenToComponent(ByRef x As Integer, ByRef y As Integer)
| Parameter | Description |
| x | X-coordinate to convert. |
| y | Y-coordinate to convert. |
Remarks
The ScreenToComponent method converts the x and y coordinates relative to the top left corner of the screen into coordinates relative to the top left corner of the component.
The reciprocal conversion is possible using the ComponentToScreen method. These two methods are often used together to convert coordinates relative to one component into coordinates relative to another component.
The example below illustrates this by converting coordinates relative to a Button control into coordinates relative to the form on which it is found:
Private Sub Button1_PenDown(ByVal x As Integer, ByVal y As Integer) Button1.ComponentToScreen x, y Me.ScreenToComponent x, y ' code using x and y End Sub
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | N/A |