Form in a Parent Form's Frame - Is it possible 
Author Message
 Form in a Parent Form's Frame - Is it possible

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?

Thanks,

Carson



Tue, 13 Jul 2004 04:06:23 GMT  
 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



Tue, 13 Jul 2004 09:32:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Manipulate 'parent' forms

2. MDI parent forms and 'fixed borderstyle'

3. Access Parent Form's Menu

4. Child Form Can't Update Parent...

5. MDI child form is moving down from it's parent

6. Can't get HWnd of real parent form since usercontrol container changes during load

7. App.Path of the Usercontrol's Parent form

8. Help on MDI Parent form's menu

9. VB5: Crystal Reports child-window haven't title in MDI-parent form

10. App.Path of the Usercontrol's Parent form

11. Help: Change a MDI child's parent MDI form at run-time

12. Trapping KeyStrokes inside a UserControl for it's parent form

 

 
Powered by phpBB® Forum Software