有一个MDIForm  Form1
下面有两个 子窗体(MDIchild 属性为 True)form2 form3
form2 和form3 上有frame1 frame1中有Grid1
我编写的MDIfrom form1是适合800×600用的,但是如果在1024×768下用的话就很小而且正好grid1也有很多信息显示不下。我怎么样在是MDIform变成最大的时候下面子窗体的form2、form2中的frame1、frame1下的grid1能跟着成比例放大?

解决方案 »

  1.   

    能不能实现拉动MDIform大小的时候也能实现内部子窗体和子窗体中的控件同步放大
      

  2.   

    Private Sub Form_Resize()
      '在这里面写代码使得里面的控件也和窗体同步的比例变化
    End Sub
      

  3.   

    MDIForm's Code
    Option Explicit
    Private intWidth As Integer
    Private intHeight As Integer
    Private WithEvents frm1 As Form
    Private Sub MDIForm_Load()
        
        Set frm1 = New Form1
        intWidth = Me.Width
        intHeight = Me.Height
    End SubPrivate Sub MDIForm_Resize()
        Dim dblWidthRate As Double
        Dim dblHeightRate As Double
        dblWidthRate = Me.Width / intWidth
        dblHeightRate = Me.Height / intHeight
        frm1.UpdateSize dblWidthRate, dblHeightRate
        intWidth = Me.Width
        intHeight = Me.Height
    End Sub
    Form1' Code
    Option Explicit
    Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function IsZoomed Lib "user32" (ByVal hwnd As Long) As Long
    Public Sub UpdateSize(dblWidthRate As Double, dblHeightRate As Double)
        If Not (IsIconic(Me.hwnd) Or IsZoomed(Me.hwnd)) Then
            Me.Width = Me.Width * dblWidthRate
            Me.Height = Me.Height * dblHeightRate
            Me.Refresh
        End If
    End Sub子窗体最大、最小化是会出错!望高手解决!
      

  4.   

    一。在form_resize里写代码
    二。网上有现成控件,可以试试。
      

  5.   

    to  Lixx_XIT(阿苏大发)
    if me.WindoeState=1 orme.WindoeState=2 then exit sub