Form Math

NigelShaw

Registered User.
Local time
Today, 07:49
Joined
Jan 11, 2008
Messages
1,575
Hi Guys,

just cant my head into gear today....... i am trying to set 4 points on a form. i am using RECT


Code:
Private Type RECT
 Left As Long
 Top As Long
 Right As Long
 Bottom As Long
End Type

i am setting this

Code:
Dim FrameRect As RECT

i can get a return from the form of 4 co-ordinates Left, Right, Top Bottom. These are the co=ordinates for the Client Form ( inside the pop up window ) but i need to set the co-ords by using a rectangle instead. I just cannot get my head into working out how get the Left, Right, Top, Bottom by using the rectangle on the form.

Any Ideas anyone that you could help me with?

im thinking deducting something from RECT but its not computing with me. Must have been a long week lol


any help really really appreciated.


cheers

Nidge
 
What did you try?

Try google with this "sample use of Public type in vba"

You'll get a couple of hits that may be helpful.
 
Hello mate.

the rectangle on my form has these properties-

Left - 3.199cm
Top - 0.199cm
Width - 13.898cm
Height = 10.818cm

by using this code, i can get the RECT of the popup form

Code:
Private Type RECT
 Left As Long
 Top As Long
 Right As Long
 Bottom As Long
End Type

Dim FrameRect As RECT

Set MyRec = CaptureWindow(FrameHandle, True, 0, 0, _
FrameRect.Right - FrameRect.Left - 6, FrameRect.Bottom - FrameRect.Top - 28)

the return value for this is-
0,0,1600,150

the return value for the rectangle when called via MsgBox is-
0,0,11284,7267

the rectangle is the exact same size as the form. its the conversion im struggling and or a deduction. what does RECT return a value in? pixels, points or twips? do i need to deduct rectangle sizes from the RECT sizes?

cheers

nidge
 
figured it out. Divided the windowwidth by the RECT

cheers

Nidge
 

Users who are viewing this thread

Back
Top Bottom