
Form in a Parent Form's Frame - Is it possible
Quote:
>Is it possible to put a form in the frame of another form so that if
>the frame is resized, so is the inside form?
Like this ?
Form1 code.: (form2 has no code)
Option Explicit
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long,
ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight
As Long, ByVal bRepaint As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As
Long, ByVal hWndNewParent As Long) As Long
Private Sub Form_Load()
Form2.Show
Call SetParent(Form2.hwnd, Me.hwnd)
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next
Unload Form2
End Sub
Private Sub Form_Resize()
Static inResize As Boolean
If inResize = True Then Exit Sub
inResize = True
Call MoveWindow(Form2.hwnd, ScaleX(0, Me.ScaleMode, vbPixels), _
ScaleY(0, Me.ScaleMode, vbPixels), _
ScaleX(Me.Width / 2, Me.ScaleMode, vbPixels), _
ScaleY(Me.Height / 2, Me.ScaleMode, vbPixels), _
CLng(True))
inResize = False
End Sub
Regards, Frank