Hello,
How do i get the distance in pixels between the top left point and lower left point of a rectangle? What are all 4 points on a rectangle named? 0,0 1,1 or something?
Thanks for any help!
Hello,
How do i get the distance in pixels between the top left point and lower left point of a rectangle? What are all 4 points on a rectangle named? 0,0 1,1 or something?
Thanks for any help!
To get the distance from top to bottom and left to right is very simple:
Distance from top to bottom = rectangle's height
Distance from left to right = rectangle's width
I don't quite follow your other question.
BTW, if you wanted to get the distance from the top left vertex to the bottom right vertex of a rectangle, I think you would have to use Pythagoras' theory.
Use the Distance equation:
Z.Code:dist = sqrt(((x2-x1)^2) + ((y2-y1)^2))
if the rectangle you mention is a form, then you can use the [color]GetClientrect[/color] API function call.
regards,VB Code:
Option Explicit '// WIN32API Function Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long '// WIN32API Structure Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Sub Command1_Click() Dim rc As RECT GetClientRect Me.hwnd, rc Debug.Print "(" & rc.Left & ", " & rc.Top & ") (" & rc.Right & "," & rc.Bottom & ")" End Sub