In my project I work with the distance of elements and their size. But on a 600-by-600 screen, when you insert a 100-percent object, it appears to be much smaller than 1/6 of the screen, and when checking the distance from the object's center point to the Mouse
//descobrir o ponto central do objeto atual
Point ponto_central_obj = new Point(objeto.Location.X+50,objeto.Location.Y+50);
//calcular distancia X e Y
int distancia_x = ponto.X - ponto_central_obj.X;
int distancia_y = ponto.Y - ponto_central_obj.Y;
if(distancia_x < 0){distancia_x = distancia_x * -1;}
if(distancia_y < 0){distancia_y = distancia_y * -1;}
int distancia = Math.Sqrt((distancia_x ^ 2) + (distancia_y ^ 2));
And by passing the mouse near the edge the given distance is 15, 16 or something close, which is much smaller than 50, which is the minimum distance from the center point to the edge of the object.
Questions
Based on this I ask the following questions.
-
Are the x and y coordinates not the distance in pixels from the upper left corner of the screen?
-
If not, how to convert the value to distance in pixels ?
-
Are they relative to the size of the parent object?