回复 10楼 yjfken
当局者迷,旁观者清。楼主这是何苦啊。悬崖勒马,回头是岸。
程序代码:
CLEAR ALL
Main()
CLEAR ALL
RETURN
PROCEDURE Main()
LOCAL loForms
loForms = NEWOBJECT("C_Formset")
loForms.Show
READ EVENTS
ENDPROC
DEFINE CLASS C_Formset AS FormSet
ADD OBJECT Form1 AS Form WITH Width = 600, Height = 400, AutoCenter = .T.
ADD OBJECT Form2 AS Form WITH Width = 300, Height = 200, AlwaysOnTop = .T.
PROCEDURE Form1.Destroy
RELEASE ThisFormset
ENDPROC
PROCEDURE Form2.Top_Assign(tnTop)
IF tnTop < ThisFormset.Form1.Top + 32
tnTop = ThisFormset.Form1.Top + 32
ENDIF
This.Top = tnTop
IF This.Top + This.Height > ThisFormset.Form1.Top + ThisFormset.Form1.Height - 10
This.Height = ThisFormset.Form1.Top + ThisFormset.Form1.Height - 10 - This.Top
ENDIF
ENDPROC
PROCEDURE Form2.Left_Assign(tnLeft)
IF tnLeft < ThisFormset.Form1.Left + 10
tnLeft = ThisFormset.Form1.Left + 10
ENDIF
This.Left = tnLeft
IF This.Left + This.Width > ThisFormset.Form1.Left + ThisFormset.Form1.Width - 10
This.Width = ThisFormset.Form1.Left + ThisFormset.Form1.Width - 10 - This.Left
ENDIF
ENDPROC
PROCEDURE Form2.Width_Assign(tnWidth)
IF This.Left + tnWidth > ThisFormset.Form1.Left + ThisFormset.Form1.Width - 10
tnWidth = ThisFormset.Form1.Left + ThisFormset.Form1.Width - 10 - This.Left
ENDIF
This.Width = tnWidth
ENDPROC
PROCEDURE Form2.Height_Assign(tnHeight)
IF This.Top + tnHeight > ThisFormset.Form1.Top + ThisFormset.Form1.Height - 10
tnHeight = ThisFormset.Form1.Top + ThisFormset.Form1.Height - 10 - This.Top
ENDIF
This.Height = tnHeight
ENDPROC
PROCEDURE Init
WITH ThisFormset
.Form2.Top = .Form1.Top + 50
.Form2.Left = .Form1.Left + 50
ENDWITH
ENDPROC
PROCEDURE Destroy
CLEAR EVENTS
ENDPROC
ENDDEFINE
