放入窗体中,自动根据系统的分辨率调整控件的大小和位置

解决方案 »

  1.   

    你在from的resize里面写代码控制控件大小就可以解决问题!
      

  2.   

    如果每个FORM里写的话是可以,但是如果项目大的话就太麻烦了,
    以前我好象看到过,现在找不到了
      

  3.   

    resize事件Dim m as controlfor each m in me
        m.width = m.width*percent
        m.height = m.height*percent
    next
      

  4.   

    我有控件,只要在Form里面的控件都能实现随分辨率变化、Form的大小变化而变化,但是如果是UserControl里面的控件就不可以:)
      

  5.   

    Lixx_XIT你好,能不能发一个给我 [email protected]
      

  6.   

    iloveyour(爱老虎油)
    发到你信箱了
      

  7.   

    Option Explicit
    Dim M_Width As Double
    Dim M_Height As DoublePrivate Sub Form_Load()
          
          M_Width = Me.ScaleWidth
          M_Height = Me.ScaleHeight
          Me.Show
          
    End SubPrivate Sub Form_Resize()
        Dim Ctrl As Control
        Dim NewWidth As Double
        Dim NewHeight As Double
        Dim M_WPercent As Double
       Dim M_HPercent As Double    On Error Resume Next
        
        NewWidth = Me.ScaleWidth
        NewHeight = Me.ScaleHeight
        
        M_WPercent = NewWidth / M_Width
        M_HPercent = NewHeight / M_Height
            
        M_Width = NewWidth
        M_Height = NewHeight
            
        For Each Ctrl In Me.Controls        Ctrl.Left = Ctrl.Left * M_WPercent
            Ctrl.Width = Ctrl.Width * M_WPercent
            
            Ctrl.Top = Ctrl.Top * M_HPercent
            Ctrl.Height = Ctrl.Height * M_HPercent
            
        Next
        
    End Sub